diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-01-01 11:04:55 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-01 12:38:50 -0800 |
commit | 2a579987c2a4ffc85ee5867492381bd57aebd731 (patch) | |
tree | 6d0f1394161adae2b918aec44731619c35310097 | |
parent | 3a65b0f37f80b5dd93b9b7ccc8ac5c0653d95e4b (diff) | |
download | subsurface-2a579987c2a4ffc85ee5867492381bd57aebd731.tar.gz |
fix potential crash in GPS code
If we don't have a GpsLocation instance, we shouldn't dereference it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-models/gpslistmodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp index 5fa7d1081..1cb6c8271 100644 --- a/qt-models/gpslistmodel.cpp +++ b/qt-models/gpslistmodel.cpp @@ -11,7 +11,10 @@ GpsListModel::GpsListModel() void GpsListModel::update() { - QVector<gpsTracker> trackers = QVector<gpsTracker>::fromList(GpsLocation::instance()->currentGPSInfo().values()); + GpsLocation *glp = GpsLocation::instance(); + if (!glp) + return; + QVector<gpsTracker> trackers = QVector<gpsTracker>::fromList(glp->currentGPSInfo().values()); beginResetModel(); m_gpsFixes = trackers; endResetModel(); |