mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 13:10:55 +01:00
Fixed unhandled exception on handleGapEvent (#112)
Somehow, the conn_handle can have the value of `0xffff`. Not sure why or how, but anyway it should be managed before moving forward on NimBLECharacteristic::handleGapEvent. Otherwise, an unhandled exception will occur on `assert(rc == 0);`
This commit is contained in:
parent
c1e7a521b7
commit
4ff9baf68a
1 changed files with 6 additions and 0 deletions
|
@ -261,6 +261,12 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
|
||||||
struct ble_gatt_access_ctxt *ctxt,
|
struct ble_gatt_access_ctxt *ctxt,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
|
if (conn_handle > BLE_HCI_LE_CONN_HANDLE_MAX)
|
||||||
|
{
|
||||||
|
NIMBLE_LOGW(LOG_TAG, "Conn_handle (%d) is above the maximum value (%d)", conn_handle, BLE_HCI_LE_CONN_HANDLE_MAX);
|
||||||
|
return BLE_ATT_ERR_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
const ble_uuid_t *uuid;
|
const ble_uuid_t *uuid;
|
||||||
int rc;
|
int rc;
|
||||||
NimBLEConnInfo peerInfo;
|
NimBLEConnInfo peerInfo;
|
||||||
|
|
Loading…
Reference in a new issue