device-manager: Add null check in handle_device_connected() 43/271643/1 accepted/tizen/6.5/unified/20220224.125822 submit/tizen_6.5/20220224.051938
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Feb 2022 05:40:50 +0000 (14:40 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 24 Feb 2022 05:03:22 +0000 (14:03 +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] 13.0.82
[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 57aea54..c328dfb 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.81
+Version:          13.0.82
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 7cb46c9..eeba35c 100644 (file)
@@ -2186,8 +2186,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);