Prevent Issue fixes
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / src / bt-hal-gatt-client.c
index 633ec00..cc5b5b8 100644 (file)
@@ -3421,25 +3421,27 @@ void _bt_hal_handle_gattc_value_changed_event(int result, const char *char_handl
        _bt_hal_convert_addr_string_to_type(bd_addr.address, device_address);
        conn_info =  __bt_find_gatt_conn_info(&bd_addr);
 
-       //find service for notified char path
-       for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) {
-               svc_info = (hal_gattc_service_t*)l->data;
-               if (svc_info == NULL)
-                       continue;
-
-               /* find characteristic object path */
-               for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) {
-                       char_info = (hal_gattc_char_t *)k->data;
-                       if (char_info == NULL)
+       if (conn_info != NULL) {
+               //find service for notified char path
+               for (l = conn_info->gatt_list_services; l != NULL; l = g_slist_next(l)) {
+                       svc_info = (hal_gattc_service_t*)l->data;
+                       if (svc_info == NULL)
                                continue;
 
-                       if (g_strcmp0(char_info->chr_path, char_handle) == 0) {
-                               DBG("Found char handle[%s]", char_info->chr_path);
+                       /* find characteristic object path */
+                       for (k = svc_info->gatt_list_chars; k != NULL; k = g_slist_next(k)) {
+                               char_info = (hal_gattc_char_t *)k->data;
+                               if (char_info == NULL)
+                                       continue;
+
+                               if (g_strcmp0(char_info->chr_path, char_handle) == 0) {
+                                       DBG("Found char handle[%s]", char_info->chr_path);
 
-                               //send event
-                               _bt_hal_send_value_changed_event(conn_info, svc_info,
-                                               char_info, char_value, len);
-                               return;
+                                       //send event
+                                       _bt_hal_send_value_changed_event(conn_info, svc_info,
+                                                       char_info, char_value, len);
+                                       return;
+                               }
                        }
                }
        }