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>
This commit is contained in:
Dirk Hohndel 2021-01-01 11:04:55 -08:00
parent 3a65b0f37f
commit 2a579987c2

View file

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