diff --git a/common/DiscoveredCharacteristic.cpp b/common/DiscoveredCharacteristic.cpp index dc9b386..6b04ca1 100644 --- a/common/DiscoveredCharacteristic.cpp +++ b/common/DiscoveredCharacteristic.cpp @@ -37,6 +37,10 @@ DiscoveredCharacteristic::read(uint16_t offset) const return BLE_ERROR_OPERATION_NOT_PERMITTED; } + if (!gattc) { + return BLE_ERROR_INVALID_STATE; + } + return gattc->read(connHandle, valueHandle, offset); }