diff --git a/examples/meshtastic/cpp/ble/ble.cpp b/examples/meshtastic/cpp/ble/ble.cpp index a429ca4..213bfa3 100644 --- a/examples/meshtastic/cpp/ble/ble.cpp +++ b/examples/meshtastic/cpp/ble/ble.cpp @@ -181,6 +181,10 @@ void BLE::errorReceived(QLowEnergyController::Error) { } void BLE::disconnect() { + if (controller == nullptr) { + return; + } + if (controller->state() != QLowEnergyController::UnconnectedState) { controller->disconnectFromDevice(); } else {