From f5f3054a7a5c71b48297291434488b0bbbcbf4fe Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 17 Jul 2020 12:04:12 +0100 Subject: [PATCH] Launcher: Fix cast of helipd to runway Should fix trying to retrieve an ILS from a pad. --- src/GUI/LocationController.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/GUI/LocationController.cxx b/src/GUI/LocationController.cxx index ccb95aa1b..e5a071a47 100644 --- a/src/GUI/LocationController.cxx +++ b/src/GUI/LocationController.cxx @@ -973,14 +973,17 @@ void LocationController::onCollectConfig() if (m_airportLocation->type() == FGPositioned::AIRPORT) { m_config->setArg("runway", QString::fromStdString(m_detailLocation->ident())); + if (ty == FGPositioned::RUNWAY) { // set nav-radio 1 based on selected runway - FGRunway* runway = static_cast(m_detailLocation.ptr()); - if (runway->ILS()) { - double mhz = runway->ILS()->get_freq() / 100.0; - m_config->setArg("nav1", QString("%1:%2").arg(runway->headingDeg()).arg(mhz)); + auto runway = fgpositioned_cast(m_detailLocation); + if (runway->ILS()) { + double mhz = runway->ILS()->get_freq() / 100.0; + m_config->setArg("nav1", QString("%1:%2").arg(runway->headingDeg()).arg(mhz)); + } + + applyOnFinal(); } - applyOnFinal(); } else if (m_airportLocation->type() == FGPositioned::HELIPORT) { m_config->setArg("runway", QString::fromStdString(m_detailLocation->ident())); }