Fix null pointer dereference in updateBatteryLevel function (#10588)
This commit is contained in:
@@ -862,7 +862,7 @@ void NimbleBluetooth::setupService()
|
|||||||
/// Given a level between 0-100, update the BLE attribute
|
/// Given a level between 0-100, update the BLE attribute
|
||||||
void updateBatteryLevel(uint8_t level)
|
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->setValue(&level, 1);
|
||||||
BatteryCharacteristic->notify();
|
BatteryCharacteristic->notify();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user