Fix null pointer dereference in updateBatteryLevel function (#10588)

This commit is contained in:
Austin
2026-05-31 14:46:28 -04:00
committed by GitHub
co-authored by GitHub
parent 64e35908c9
commit 3feb155a5f
+1 -1
View File
@@ -862,7 +862,7 @@ void NimbleBluetooth::setupService()
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level)
{
if ((config.bluetooth.enabled == true) && nimbleBluetooth->isConnected()) {
if ((config.bluetooth.enabled == true) && nimbleBluetooth && nimbleBluetooth->isConnected()) {
BatteryCharacteristic->setValue(&level, 1);
BatteryCharacteristic->notify();
}