From a0d5b7d181f74d7336aa8f72b7323b69e8618bea Mon Sep 17 00:00:00 2001 From: Ryan Powell Date: Tue, 5 Aug 2025 06:08:03 -0600 Subject: [PATCH] [BLE] Fix crash if BLE stack is not initialized when setting advertising. (#2212) --- main/blufi.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/blufi.cpp b/main/blufi.cpp index 4041f12..5dabe29 100644 --- a/main/blufi.cpp +++ b/main/blufi.cpp @@ -202,6 +202,10 @@ void stop_connection_timer() {} # endif void set_blufi_mfg_data () { + if (!NimBLEDevice::isInitialized() || !NimBLEDevice::getAdvertising()->isAdvertising()) { + Log.notice(F("Unable to set advertising data" CR)); + return; + } ble_hs_adv_fields fields; ble_uuid16_t blufi_uuid = BLE_UUID16_INIT(BLUFI_APP_UUID); memset(&fields, 0, sizeof(fields));