fix crash during shutdown (#2859)

* fix null pointer access

* ptr initialize
This commit is contained in:
Manuel 2023-10-03 13:37:46 +02:00 committed by GitHub
parent 94c2ade272
commit f301e236eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

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.

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);