Remove descriptor asserts when the connection info is not found.

* Trigger onRead callbacks when the connection handle is NONE (internal).
This commit is contained in:
h2zero
2024-07-03 13:01:57 -06:00
committed by h2zero
parent b8d6e3d87f
commit a5dd84b2f9
2 changed files with 5 additions and 6 deletions

View File

@@ -282,6 +282,7 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
// If the packet header is only 8 bytes this is a follow up of a long read
// so we don't want to call the onRead() callback again.
if(ctxt->om->om_pkthdr_len > 8 ||
conn_handle == BLE_HS_CONN_HANDLE_NONE ||
pCharacteristic->m_value.size() <= (ble_att_mtu(peerInfo.m_desc.conn_handle) - 3)) {
pCharacteristic->m_pCallbacks->onRead(pCharacteristic, peerInfo);
}