diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 87cda5c4b..025e6007b 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -20,7 +20,7 @@ HardwareSerial *GPS::_serial_gps = &Serial1; HardwareSerial *GPS::_serial_gps = NULL; #endif -GPS *gps; +GPS *gps = nullptr; /// Multiple GPS instances might use the same serial port (in sequence), but we can /// only init that port once. diff --git a/src/sleep.cpp b/src/sleep.cpp index 532aad519..da3e43dcb 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -193,7 +193,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false) nodeDB.saveToDisk(); // Kill GPS power completely (even if previously we just had it in sleep mode) - gps->setGPSPower(false, false, 0); + if (gps) + gps->setGPSPower(false, false, 0); setLed(false);