From db60ab08fa342c27b42893b5cd2fb32676740fc5 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 11 May 2010 21:06:56 +0100 Subject: [PATCH] Bug 131, crash with invalid ICAO in the ATCDCL code, replaced an assert with a guard. --- src/ATCDCL/ground.cxx | 6 +++++- src/ATCDCL/tower.cxx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ATCDCL/ground.cxx b/src/ATCDCL/ground.cxx index 08a320613..e5d9c17d5 100644 --- a/src/ATCDCL/ground.cxx +++ b/src/ATCDCL/ground.cxx @@ -362,7 +362,11 @@ void FGGround::DoRwyDetails() { //cout << "GetRwyDetails called" << endl; const FGAirport* apt = fgFindAirportID(ident); - assert(apt); + if (!apt) { + SG_LOG(SG_ATC, SG_WARN, "FGGround::DoRwyDetails: unknown ICAO:" << ident); + return; + } + FGRunway* runway = apt->getActiveRunwayForUsage(); activeRwy = runway->ident(); diff --git a/src/ATCDCL/tower.cxx b/src/ATCDCL/tower.cxx index fa54b15cf..d44e33018 100644 --- a/src/ATCDCL/tower.cxx +++ b/src/ATCDCL/tower.cxx @@ -1505,7 +1505,11 @@ void FGTower::DoRwyDetails() { // Based on the airport-id and wind get the active runway const FGAirport* apt = fgFindAirportID(ident); - assert(apt); + if (!apt) { + SG_LOG(SG_ATC, SG_WARN, "FGTower::DoRwyDetails: unknown ICAO:" << ident); + return; + } + FGRunway* runway = apt->getActiveRunwayForUsage(); activeRwy = runway->ident(); -- 2.39.5