From 8568b56ac6cdcc39efdc19b3c0fd6cad27d51ac0 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 7 Aug 2025 12:28:01 -0500 Subject: [PATCH] Fix a crash on Native reboot (#7570) --- src/Power.cpp | 6 ++++-- src/mesh/api/WiFiServerAPI.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Power.cpp b/src/Power.cpp index b489bc33c..8a16132f1 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -724,10 +724,12 @@ void Power::reboot() SPI.end(); Wire.end(); Serial1.end(); - if (screen) + if (screen) { delete screen; + screen = nullptr; + } LOG_DEBUG("final reboot!"); - reboot(); + ::reboot(); #elif defined(ARCH_STM32WL) HAL_NVIC_SystemReset(); #else diff --git a/src/mesh/api/WiFiServerAPI.cpp b/src/mesh/api/WiFiServerAPI.cpp index 5b63bc165..b19194f78 100644 --- a/src/mesh/api/WiFiServerAPI.cpp +++ b/src/mesh/api/WiFiServerAPI.cpp @@ -17,7 +17,10 @@ void initApiServer(int port) } void deInitApiServer() { - delete apiPort; + if (apiPort) { + delete apiPort; + apiPort = nullptr; + } } WiFiServerAPI::WiFiServerAPI(WiFiClient &_client) : ServerAPI(_client)