Fix crash issue when write_cb is NULL 37/305537/1
authorWootak Jung <wootak.jung@samsung.com>
Thu, 1 Feb 2024 06:45:38 +0000 (15:45 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Mon, 5 Feb 2024 01:28:41 +0000 (10:28 +0900)
Change-Id: I4dc116d88a8d527ffc865e2fbeeed17e5365fde3
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/bluetooth-gatt.c

index 34daf28..4330f75 100644 (file)
@@ -4415,8 +4415,10 @@ int bt_gatt_client_write_value(bt_gatt_h gatt_handle,
                        chr->write_user_data = user_data;
                }
 
-               if (chr->write_type == BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE)
-                       chr->write_cb(ret, gatt_handle, user_data);
+               if (chr->write_type == BT_GATT_WRITE_TYPE_WRITE_NO_RESPONSE) {
+                       if (chr->write_cb)
+                               chr->write_cb(ret, gatt_handle, user_data);
+               }
        } else if (c->type == BT_GATT_TYPE_DESCRIPTOR) {
                bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s *)gatt_handle;