fix crash during shutdown (#2859)

* fix null pointer access

* ptr initialize
This commit is contained in:
Manuel
2023-10-03 06:37:46 -05:00
committed by GitHub
co-authored by GitHub
parent 94c2ade272
commit f301e236eb
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -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.
+2 -1
View File
@@ -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);