diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/lib/bluetooth/hal-bt-data.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/lib/bluetooth/hal-bt-data.c b/plugins/lib/bluetooth/hal-bt-data.c index eefd9f1..61d774b 100644 --- a/plugins/lib/bluetooth/hal-bt-data.c +++ b/plugins/lib/bluetooth/hal-bt-data.c @@ -173,14 +173,14 @@ int HalBtDataHandleReceivedSingleBtDeviceData(struct HalBtPluginData *halBtPlugi char *currentBtDeviceAddress, *currentBtDeviceIsConnectedString, *currentBtDeviceIsAVPConnectedString; - json_object *currentBtAllProfilesJ, *currentBtCurrentProfileJ; + json_object *currentBtAllProfilesJ = NULL, *currentBtCurrentProfileJ; struct HalBtDeviceData *currentBtDevice; if(! halBtPluginData || ! currentSingleBtDeviceDataJ) return -1; if(wrap_json_unpack(currentSingleBtDeviceDataJ, - "{s:s s:s s:s s:o}", + "{s:s s:s s:s s?:o}", "Address", ¤tBtDeviceAddress, "Connected", ¤tBtDeviceIsConnectedString, "AVPConnected", ¤tBtDeviceIsAVPConnectedString, @@ -188,6 +188,11 @@ int HalBtDataHandleReceivedSingleBtDeviceData(struct HalBtPluginData *halBtPlugi return -2; } + if(! currentBtAllProfilesJ) { + AFB_ApiInfo(halBtPluginData->currentHalApiHandle, "Bluetooth device (address = %s) has no specified profiles, ignore it", currentBtDeviceAddress); + return 0; + } + if(json_object_is_type(currentBtAllProfilesJ, json_type_array)) { btProfilesCount = json_object_array_length(currentBtAllProfilesJ); @@ -260,9 +265,10 @@ int HalBtDataHandleReceivedMutlipleBtDeviceData(struct HalBtPluginData *halBtPlu btDeviceNumber = json_object_array_length(currentMultipleBtDeviceDataJ); for(idx = 0; idx < btDeviceNumber; idx++) { - if((err = HalBtDataHandleReceivedSingleBtDeviceData(halBtPluginData, json_object_array_get_idx(currentMultipleBtDeviceDataJ, (unsigned int) idx)))) + if((err = HalBtDataHandleReceivedSingleBtDeviceData(halBtPluginData, json_object_array_get_idx(currentMultipleBtDeviceDataJ, (unsigned int) idx)))) { return ((int) idx * err * 10); + } } return 0; -}
\ No newline at end of file +} |