From: James Turner Date: Fri, 16 Oct 2015 01:05:35 +0000 (-0500) Subject: Fix a package crash on startup. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca1f8cddc9dcd4bfe90b9ae67a5bbac097f9fb90;p=flightgear.git Fix a package crash on startup. --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 3f5682f03..78a93bbe3 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -546,9 +546,11 @@ int fgInitAircraft(bool reinit) // code in FindAndCacheAircraft works as normal // note since we may be using a variant, we can't use the package ID size_t lastDot = aircraftId.rfind('.'); - assert(lastDot != std::string::npos); - aircraftId = aircraftId.substr(lastDot + 1); + if (lastDot == std::string::npos) { + aircraftId = aircraftId.substr(lastDot + 1); + } aircraftProp->setStringValue(aircraftId); + // run the traditional-code path below } else { #if 0 @@ -559,6 +561,7 @@ int fgInitAircraft(bool reinit) return flightgear::FG_OPTIONS_ERROR; #endif + // fall back the default aircraft instead } }