Skip to content

Commit

Permalink
Fix crash when peer disconnects from the server if client wasn't crea…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
h2zero committed Dec 9, 2024
1 parent 6d10f2f commit 6fa6849
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NimBLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
pServer->m_pClient->m_connHandle = BLE_HS_CONN_HANDLE_NONE;
}
Expand Down

0 comments on commit 6fa6849

Please sign in to comment.