Check if m_pServerCallbacks is not null before calling method. (#5603)
Fixes: https://github.com/espressif/arduino-esp32/issues/5573 To reproduce: 1. Run any sample code that starts a BLE server, and does not call `setCallbacks`. 2. Connect to the device using the "LightBlue" app on iOS. 3. Observe crash shown in the issue linked above.
This commit is contained in:
parent
24b76cbb14
commit
9eea85f9ff
@ -157,7 +157,9 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t
|
|||||||
|
|
||||||
case ESP_GATTS_MTU_EVT:
|
case ESP_GATTS_MTU_EVT:
|
||||||
updatePeerMTU(param->mtu.conn_id, param->mtu.mtu);
|
updatePeerMTU(param->mtu.conn_id, param->mtu.mtu);
|
||||||
m_pServerCallbacks->onMtuChanged(this, param);
|
if (m_pServerCallbacks != nullptr) {
|
||||||
|
m_pServerCallbacks->onMtuChanged(this, param);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// ESP_GATTS_CONNECT_EVT
|
// ESP_GATTS_CONNECT_EVT
|
||||||
|
Loading…
Reference in New Issue
Block a user