From 83c8c7e0c393a629b8f00d4a2122b7e5f98cbab4 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 6 Dec 2020 18:43:04 +0000 Subject: [PATCH] RunwayPrefs: fix an edge case (at KORD) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we reject all preferences due to missing runways, don’t end up with un-initialized values. --- src/Airports/runwayprefs.cxx | 4 ++++ src/Airports/runwayprefs.hxx | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Airports/runwayprefs.cxx b/src/Airports/runwayprefs.cxx index 12ab521e5..f0d203211 100644 --- a/src/Airports/runwayprefs.cxx +++ b/src/Airports/runwayprefs.cxx @@ -349,6 +349,10 @@ void RunwayGroup::setActive(const FGAirport * airport, return; } } + + // failed to find any valid runways + active = -1; + nrActive = 0; } void RunwayGroup::getActive(int i, std::string & name, std::string & type) diff --git a/src/Airports/runwayprefs.hxx b/src/Airports/runwayprefs.hxx index ef426f654..8ce66ad8c 100644 --- a/src/Airports/runwayprefs.hxx +++ b/src/Airports/runwayprefs.hxx @@ -89,12 +89,12 @@ class RunwayGroup private: std::string name; RunwayListVec rwyList; - int active; + int active = -1; //stringVec runwayNames; int choice[2]; - int nrActive; + int nrActive = 0; -public: + public: RunwayGroup() {}; RunwayGroup(const RunwayGroup &other); RunwayGroup &operator= (const RunwayGroup &other);