[Bluetooth][fix] Small fix of crash in ParseServiceData 76/240876/1
authorArkadiusz Pietraszek <a.pietraszek@samsung.com>
Wed, 12 Aug 2020 09:13:42 +0000 (11:13 +0200)
committerArkadiusz Pietraszek <a.pietraszek@samsung.com>
Wed, 12 Aug 2020 09:13:42 +0000 (11:13 +0200)
There was a small mistake that caused crash when advertising with BLE
adapter and using service data.

[Verification] Code compiles and executes without crash or errors.

Change-Id: I4254e800ee7fda21e6eb71c7f7f03d6b4a399beb
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
src/bluetooth/bluetooth_le_adapter.cc

index 2a0fcd6759e11c9fa05cc5eb7e9110b88fb80594..caad799efc6604a8ea490ead242f8ed4113bfefb 100644 (file)
@@ -119,7 +119,7 @@ class BluetoothLEServiceData : public ParsedDataHolder {
 
  private:
   BluetoothLEServiceData(UUID&& uuid, const std::string& data_str) : uuid_{std::move(uuid)} {
-    ScopeLogger("UUID: %s, data_str: %s", uuid.uuid_128_bit.c_str(), data_str.c_str());
+    ScopeLogger("UUID: %s, data_str: %s", uuid_.uuid_128_bit.c_str(), data_str.c_str());
 
     data_.Parse(data_str);
 
@@ -325,7 +325,7 @@ class BluetoothLEAdvertiseData : public ParsedDataHolder {
     const auto& service_data_obj = obj.get(kServiceData);
     if (service_data_obj.is<picojson::null>()) {
       return true;
-    } else if (!service_data_obj.is<picojson::value>()) {
+    } else if (!service_data_obj.is<picojson::object>()) {
       return false;
     }