Skip to content

Commit f528a31

Browse files
finger563h2zero
authored andcommitted
fix(NimBLEDevice): fix crash when pairing table is full
* Add missing definition for default device callbacks (which prevents calling the `setDeviceCallbacks` method) * Ensure `m_pDeviceCallbacks` inital value is set to `&defaultDeviceCallbacks` to prevent crash when pairing table is full After #295 any time the pairing table fills up, the device will crash on the next pairing attempt.
1 parent 481be02 commit f528a31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/NimBLEDevice.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ extern "C" void ble_store_config_init(void);
7676
/**
7777
* Singletons for the NimBLEDevice.
7878
*/
79-
NimBLEDeviceCallbacks* NimBLEDevice::m_pDeviceCallbacks = nullptr;
79+
NimBLEDeviceCallbacks NimBLEDevice::defaultDeviceCallbacks{};
80+
NimBLEDeviceCallbacks* NimBLEDevice::m_pDeviceCallbacks = &defaultDeviceCallbacks;
8081

8182
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
8283
NimBLEScan* NimBLEDevice::m_pScan = nullptr;

0 commit comments

Comments
 (0)