From 3feb155a5f208b50bfe80d8a5381f96d7a094baf Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 31 May 2026 14:46:28 -0400 Subject: [PATCH] Fix null pointer dereference in updateBatteryLevel function (#10588) --- src/nimble/NimbleBluetooth.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 925bcfeaa..eb4bd018f 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -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(); }