Skip to content

Commit 4b05541

Browse files
committed
Prevent crash when characteristic vector is empty.
1 parent 99939e5 commit 4b05541

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/NimBLERemoteService.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ bool NimBLERemoteService::retrieveCharacteristics(const NimBLEUUID *uuid_filter)
256256
}
257257
}
258258

259-
m_characteristicVector.back()->m_endHandle = getEndHandle();
259+
if (m_characteristicVector.size() > 0) {
260+
m_characteristicVector.back()->m_endHandle = getEndHandle();
261+
}
260262
}
261263

262264
NIMBLE_LOGD(LOG_TAG, "<< retrieveCharacteristics()");

0 commit comments

Comments
 (0)