From ca785f01e5b1dfcf1e5961bcaa7e3af2b39f27d8 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 25 Jun 2018 16:40:00 +0100 Subject: [PATCH] Launcher: Fix a crash in the new location code --- src/GUI/LocationController.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/GUI/LocationController.cxx b/src/GUI/LocationController.cxx index d7ed587d5..ef5bca30d 100644 --- a/src/GUI/LocationController.cxx +++ b/src/GUI/LocationController.cxx @@ -779,10 +779,13 @@ QVariantMap LocationController::saveLocation() const locationSet.insert("location-apt-final-distance", m_offsetNm); if (m_useActiveRunway) { locationSet.insert("location-apt-runway", "ACTIVE"); - } else if (m_detailLocation->type() == FGPositioned::RUNWAY) { - locationSet.insert("location-apt-runway", QString::fromStdString(m_detailLocation->ident())); - } else if (m_detailLocation->type() == FGPositioned::PARKING) { - locationSet.insert("location-apt-parking", QString::fromStdString(m_detailLocation->ident())); + } else if (m_detailLocation) { + const auto detailType = m_detailLocation->type(); + if (detailType == FGPositioned::RUNWAY) { + locationSet.insert("location-apt-runway", QString::fromStdString(m_detailLocation->ident())); + } else if (detailType == FGPositioned::PARKING) { + locationSet.insert("location-apt-parking", QString::fromStdString(m_detailLocation->ident())); + } } } // of location is an airport } // of m_location is valid