bluetooth: Add the device into hash table when relevant
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 16 Aug 2012 13:36:37 +0000 (16:36 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 16 Aug 2012 14:13:57 +0000 (17:13 +0300)
Fixes BMC#25215

plugins/bluetooth.c

index 44d32d1..2af0201 100644 (file)
@@ -705,8 +705,6 @@ static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
        if (device != NULL)
                goto update;
 
-       g_hash_table_insert(bluetooth_devices, g_strdup(path), device);
-
        ether_aton_r(address, &addr);
 
        snprintf(ident, 13, "%02x%02x%02x%02x%02x%02x",
@@ -721,6 +719,8 @@ static void adapter_properties_reply(DBusPendingCall *call, void *user_data)
        if (device == NULL)
                goto done;
 
+       g_hash_table_insert(bluetooth_devices, g_strdup(path), device);
+
        connman_device_set_ident(device, ident);
 
        connman_device_set_string(device, "Path", path);