From 2a579987c2a4ffc85ee5867492381bd57aebd731 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 1 Jan 2021 11:04:55 -0800 Subject: fix potential crash in GPS code If we don't have a GpsLocation instance, we shouldn't dereference it. Signed-off-by: Dirk Hohndel --- qt-models/gpslistmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 trackers = QVector::fromList(GpsLocation::instance()->currentGPSInfo().values()); + GpsLocation *glp = GpsLocation::instance(); + if (!glp) + return; + QVector trackers = QVector::fromList(glp->currentGPSInfo().values()); beginResetModel(); m_gpsFixes = trackers; endResetModel(); -- cgit v1.2.3-70-g09d2