From 40b2c3b9f76809a7b655e8fe726898206d9c34be Mon Sep 17 00:00:00 2001 From: jmt Date: Wed, 7 Apr 2010 22:27:39 +0000 Subject: [PATCH] Candidate fix for bug #118, crash with custom (scenery) airport data. --- src/Airports/runwayprefs.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Airports/runwayprefs.cxx b/src/Airports/runwayprefs.cxx index af715ac35..8337d31f9 100644 --- a/src/Airports/runwayprefs.cxx +++ b/src/Airports/runwayprefs.cxx @@ -225,7 +225,13 @@ void RunwayGroup::setActive(const FGAirport* airport, validSelection = true; for (int j = 0; j < activeRwys; j++) { - rwy = airport->getRunwayByIdent(rwyList[j].getRwyList(i)); + string ident(rwyList[j].getRwyList(i)); + if (!airport->hasRunwayWithIdent(ident)) { + SG_LOG(SG_GENERAL, SG_WARN, "no such runway:" << ident << " at " << airport->ident()); + continue; + } + + rwy = airport->getRunwayByIdent(ident); //cerr << "Succes" << endl; hdgDiff = fabs(windHeading - rwy->headingDeg());