From dfc43bae1859d677c0f1580ce1b44f6d0ae2f435 Mon Sep 17 00:00:00 2001 From: todd-herbert Date: Mon, 22 Apr 2024 00:25:58 +1200 Subject: [PATCH] Fix crash on shutdown, if Bluetooth not enabled (#3686) Previously attempted to call deinit method for a nullptr --- src/sleep.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index 548ef2c54..e58c3872a 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -213,7 +213,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false) #ifdef ARCH_ESP32 // Full shutdown of bluetooth hardware - nimbleBluetooth->deinit(); + if (nimbleBluetooth) + nimbleBluetooth->deinit(); #endif #ifdef ARCH_ESP32