device-manager: Add null check in handle_device_connected() 68/271568/1 accepted/tizen/unified/20220224.125721 submit/tizen/20220224.015132
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Feb 2022 05:40:50 +0000 (14:40 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Feb 2022 05:40:50 +0000 (14:40 +0900)
When the last parameter of handle_device_connected() is NULL,
it gets the required structure again from the list referring to
device-map.json. The result is checked now to avoid unwanted
assertion by other functions.

[Version] 15.0.2
[Issue Type] Improvement

Change-Id: Id3c07d579b1d273386a6eab2e6618abf27baabf8
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/device-manager.c

index f19401efae6a871bdf1c6cc5f10fbe5a1ec92348..667909a358cea657ad9a9936f2091172afee5e4a 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          15.0.1
+Version:          15.0.2
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 510ef2469ac2df4a0d8cadb228a73a5fb1ce06f6..51fdba96be642946a620dbcf3469f9f7c36e485d 100644 (file)
@@ -2128,8 +2128,10 @@ void handle_device_connected(pa_device_manager *dm, const char *type, const char
     pa_log_info("Device connected, type(%s) name(%s) system_id(%s) detected_type(%d)",
             type, pa_strempty(name), pa_strempty(system_id), detected_type);
 
-    if (!type_info)
-        type_info = _device_manager_get_type_info(dm->type_infos, type, NULL);
+    if (!type_info && !(type_info = _device_manager_get_type_info(dm->type_infos, type, NULL))) {
+        pa_log_error("failed to _device_manager_get_type_info(), check device-map.json first");
+        return;
+    }
 
     if (device_type_is_equal(type, DEVICE_TYPE_BT_SCO)) {
         pa_tz_device_new_data_init(&data, dm->device_list, dm->comm, dm->dbus_conn);