From: Sangchul Lee Date: Wed, 23 Feb 2022 05:40:50 +0000 (+0900) Subject: device-manager: Add null check in handle_device_connected() X-Git-Tag: submit/tizen/20220224.015132^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d972a340200f90a0b9afffb50d10cf139ebd1640;p=platform%2Fcore%2Fmultimedia%2Fpulseaudio-modules-tizen.git device-manager: Add null check in handle_device_connected() 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 --- diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index f19401e..667909a 100644 --- a/packaging/pulseaudio-modules-tizen.spec +++ b/packaging/pulseaudio-modules-tizen.spec @@ -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+ diff --git a/src/device-manager.c b/src/device-manager.c index 510ef24..51fdba9 100644 --- a/src/device-manager.c +++ b/src/device-manager.c @@ -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);