mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-18 09:10:47 +01:00
Fix crash when peer disconnects from the server.
If the server has not created a client instance then the device would crash when the peer disconnects due to nullptr access.
This commit is contained in:
parent
6d10f2f88f
commit
e4d2e991f1
1 changed files with 1 additions and 1 deletions
|
@ -397,7 +397,7 @@ int NimBLEServer::handleGapEvent(ble_gap_event* event, void* arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pServer->m_pClient->m_connHandle == event->disconnect.conn.conn_handle) {
|
if (pServer->m_pClient && pServer->m_pClient->m_connHandle == event->disconnect.conn.conn_handle) {
|
||||||
// If this was also the client make sure it's flagged as disconnected.
|
// If this was also the client make sure it's flagged as disconnected.
|
||||||
pServer->m_pClient->m_connHandle = BLE_HS_CONN_HANDLE_NONE;
|
pServer->m_pClient->m_connHandle = BLE_HS_CONN_HANDLE_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue