break;
case BLUETOOTH_EVENT_DEVICE_DISCONNECTED:
BT_INFO("bt_device_connection_state_changed_cb() will be called");
- __bt_get_bt_device_connection_info_s(&conn_info, (bt_connection_info_t *)(param->param_data));
- ((bt_device_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
- (false, conn_info, bt_event_slot_container[event_index].user_data);
- __bt_free_bt_device_connection_info_s(conn_info);
+ if (__bt_get_bt_device_connection_info_s(&conn_info, (bt_connection_info_t *)(param->param_data))
+ == BT_ERROR_NONE) {
+ ((bt_device_connection_state_changed_cb)bt_event_slot_container[event_index].callback)
+ (false, conn_info, bt_event_slot_container[event_index].user_data);
+ __bt_free_bt_device_connection_info_s(conn_info);
+ }
break;
case BLUETOOTH_EVENT_RSSI_ENABLED:
BT_INFO("bt_rssi_monitor_enabled_cb() will be called");
if (error_code == BT_ERROR_OPERATION_FAILED)
error_code = BT_ERROR_SERVICE_SEARCH_FAILED;
- __bt_get_bt_device_sdp_info_s(&sdp_info, (bt_sdp_info_t *)(param->param_data), error_code);
-
- ((bt_device_service_searched_cb)bt_event_slot_container[event_index].callback)
- (error_code, sdp_info, bt_event_slot_container[event_index].user_data);
- __bt_free_bt_device_sdp_info_s(sdp_info);
+ if (__bt_get_bt_device_sdp_info_s(&sdp_info, (bt_sdp_info_t *)(param->param_data), error_code)
+ == BT_ERROR_NONE) {
+ ((bt_device_service_searched_cb)bt_event_slot_container[event_index].callback)
+ (error_code, sdp_info, bt_event_slot_container[event_index].user_data);
+ __bt_free_bt_device_sdp_info_s(sdp_info);
+ }
break;
case BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED:
/* BT_INFO("bt_socket_data_received_cb() will be * called"); */