From: Thomas Geymayer Date: Wed, 16 Oct 2013 21:36:27 +0000 (+0200) Subject: NasalSys: do not print invalid elements for error backtraces. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c38395395065ce5d2de0cf479d35fc1861e624c;p=flightgear.git NasalSys: do not print invalid elements for error backtraces. --- diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 5015d1250..ffef17dc6 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -988,12 +988,14 @@ void FGNasalSys::loadPropertyScripts(SGPropertyNode* n) // Logs a runtime error, with stack trace, to the FlightGear log stream void FGNasalSys::logError(naContext context) { - SG_LOG(SG_NASAL, SG_ALERT, - "Nasal runtime error: " << naGetError(context)); + SG_LOG(SG_NASAL, SG_ALERT, "Nasal runtime error: " << naGetError(context)); + int stack_depth = naStackDepth(context); + if( stack_depth < 1 ) + return; SG_LOG(SG_NASAL, SG_ALERT, " at " << naStr_data(naGetSourceFile(context, 0)) << ", line " << naGetLine(context, 0)); - for(int i=1; i