From: Thomas Geymayer Date: Wed, 16 Oct 2013 21:33:06 +0000 (+0200) Subject: Nasal: do not print invalid elements for error backtraces. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b2170197234e63ff567ca070b6d5583edbab80cf;p=simgear.git Nasal: do not print invalid elements for error backtraces. --- diff --git a/simgear/nasal/code.c b/simgear/nasal/code.c index d1da92a3..5f94217f 100644 --- a/simgear/nasal/code.c +++ b/simgear/nasal/code.c @@ -941,12 +941,13 @@ naRef naContinue(naContext ctx) static void logError(naContext ctx) { - int i; - printf("logError\n"); + int i, stack_depth = naStackDepth(ctx); printf("Nasal runtime error: %s\n", naGetError(ctx)); + if( stack_depth < 1 ) + return; printf(" at %s\n", naStr_data(naGetSourceFile(ctx, 0))); printf(", line %d\n", naGetLine(ctx, 0)); - for(i = 1; i < naStackDepth(ctx); ++i ) + for(i = 1; i < stack_depth; ++i ) printf( " called from: %s, line %d", naStr_data(naGetSourceFile(ctx, i)), naGetLine(ctx, i));