gatt_client: check if hci connection for given con handle exists

This commit is contained in:
Matthias Ringwald 2018-02-09 17:41:58 +01:00
parent 49999da9ce
commit ae1d123737

View File

@ -145,6 +145,11 @@ static gatt_client_t * provide_context_for_conn_handle(hci_con_handle_t con_hand
gatt_client_t * context = get_gatt_client_context_for_handle(con_handle);
if (context) return context;
// bail if no such hci connection
if (!hci_connection_for_handle(con_handle)){
log_error("No connection for handle 0x%04x", con_handle);
return NULL;
}
context = btstack_memory_gatt_client_get();
if (!context) return NULL;
// init state