From 2d6261703af6a5b4520d90c7c437d3ab1c8a55f2 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 11 Mar 2021 18:53:17 +0800 Subject: [PATCH] fix null pointer exception in storeandforwardplugin. if null the vtable is busted cc @mc-hamster. In some cases storeForwardPluginRadio can be null ;-) ~/development/meshtastic/meshtastic-esp32$ bin/exception_decoder.py -e .pio/build/tbeam/firmware.elf ex stack: 0x401db467: StoreForwardPluginRadio::sendPayload(unsigned int, bool) at /home/kevinh/development/meshtastic/meshtastic-esp32/src/plugins/esp32/StoreForwardPlugin.cpp:235 0x400e7cbd: StoreForwardPlugin::runOnce() at /home/kevinh/development/meshtastic/meshtastic-esp32/src/plugins/esp32/StoreForwardPlugin.cpp:225 0x400d4cca: concurrency::OSThread::run() at /home/kevinh/development/meshtastic/meshtastic-esp32/src/concurrency/OSThread.cpp:45 0x400f015d: ThreadController::runOrDelay() at /home/kevinh/development/meshtastic/meshtastic-esp32/.pio/libdeps/tbeam/Thread/ThreadController.cpp:153 0x400da070: loop() at /home/kevinh/development/meshtastic/meshtastic-esp32/src/main.cpp:621 0x400ff709: loopTask(void*) at /home/kevinh/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:19 Signed-off-by: Kevin Hester --- src/plugins/esp32/StoreForwardPlugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/esp32/StoreForwardPlugin.cpp b/src/plugins/esp32/StoreForwardPlugin.cpp index 5fec31ad9..897a2c94a 100644 --- a/src/plugins/esp32/StoreForwardPlugin.cpp +++ b/src/plugins/esp32/StoreForwardPlugin.cpp @@ -83,7 +83,8 @@ int32_t StoreForwardPlugin::runOnce() DEBUG_MSG("Store & Forward Plugin - Sending heartbeat\n"); // storeForwardPluginRadio->sendPayloadHeartbeat(); - storeForwardPluginRadio->sendPayload(); + if(storeForwardPluginRadio) + storeForwardPluginRadio->sendPayload(); return (1 * 60 * 1000); }