未验证 提交 9eea85f9 编写于 作者: M Mark 提交者: GitHub

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.
上级 24b76cbb
......@@ -157,7 +157,9 @@ void BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t
case ESP_GATTS_MTU_EVT:
updatePeerMTU(param->mtu.conn_id, param->mtu.mtu);
m_pServerCallbacks->onMtuChanged(this, param);
if (m_pServerCallbacks != nullptr) {
m_pServerCallbacks->onMtuChanged(this, param);
}
break;
// ESP_GATTS_CONNECT_EVT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册