Skip to content

Commit a75de3d

Browse files
committed
Remove asserts in NimBLECharacteristic read/write.
1 parent 6b95d48 commit a75de3d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/NimBLECharacteristic.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
266266
NIMBLE_LOGW(LOG_TAG, "Conn_handle (%d) is above the maximum value (%d)", conn_handle, BLE_HCI_LE_CONN_HANDLE_MAX);
267267
return BLE_ATT_ERR_INVALID_HANDLE;
268268
}
269-
269+
270270
const ble_uuid_t *uuid;
271271
int rc;
272-
struct ble_gap_conn_desc desc;
272+
struct ble_gap_conn_desc desc{};
273273
NimBLECharacteristic* pCharacteristic = (NimBLECharacteristic*)arg;
274274

275275
NIMBLE_LOGD(LOG_TAG, "Characteristic %s %s event", pCharacteristic->getUUID().toString().c_str(),
@@ -279,8 +279,7 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
279279
if(ble_uuid_cmp(uuid, &pCharacteristic->getUUID().getNative()->u) == 0){
280280
switch(ctxt->op) {
281281
case BLE_GATT_ACCESS_OP_READ_CHR: {
282-
rc = ble_gap_conn_find(conn_handle, &desc);
283-
assert(rc == 0);
282+
ble_gap_conn_find(conn_handle, &desc);
284283

285284
// If the packet header is only 8 bytes this is a follow up of a long read
286285
// so we don't want to call the onRead() callback again.
@@ -317,8 +316,8 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
317316
len += next->om_len;
318317
next = SLIST_NEXT(next, om_next);
319318
}
320-
rc = ble_gap_conn_find(conn_handle, &desc);
321-
assert(rc == 0);
319+
320+
ble_gap_conn_find(conn_handle, &desc);
322321
pCharacteristic->setValue(buf, len);
323322
pCharacteristic->m_pCallbacks->onWrite(pCharacteristic);
324323
pCharacteristic->m_pCallbacks->onWrite(pCharacteristic, &desc);

0 commit comments

Comments
 (0)