From a7cf062930e48146802ff83c268164bc8bc0f5db Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Fri, 5 Jun 2015 08:01:58 +0100 Subject: [PATCH] add a sanity check to DiscoveredCharacteristic::read(). --- common/DiscoveredCharacteristic.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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); }