diff --git a/src/NimBLERemoteCharacteristic.cpp b/src/NimBLERemoteCharacteristic.cpp index b9c16c7..bac8574 100644 --- a/src/NimBLERemoteCharacteristic.cpp +++ b/src/NimBLERemoteCharacteristic.cpp @@ -101,6 +101,12 @@ int NimBLERemoteCharacteristic::descriptorDiscCB( bool NimBLERemoteCharacteristic::retrieveDescriptors(const NimBLEUUID* uuidFilter) const { NIMBLE_LOGD(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str()); + // If this is the last handle then there are no descriptors + if (getHandle() == getRemoteService()->getEndHandle()) { + NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found 0 descriptors."); + return true; + } + NimBLETaskData taskData(const_cast(this)); desc_filter_t filter = {uuidFilter, &taskData};