From 72d73b7fddadf610b5c26ab65db982e91a0f6595 Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 8 Sep 2006 06:15:59 +1000 Subject: [PATCH] =?UTF-8?q?Fix=20crash=20bug=20in=20cyntax=20validator=20w?= =?UTF-8?q?hen=20using=20an=20illegal=20command=20name.=20Thanks=20to=20Ma?= =?UTF-8?q?rtin=20B=C3=A4hr=20for=20the=20report.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit darcs-hash:20060907201559-ac50b-34fa01bbc40eafddcc64a5111bebd88aab75a8d4.gz --- parser.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/parser.c b/parser.c index 718e25b85..8e4e3730e 100644 --- a/parser.c +++ b/parser.c @@ -3294,25 +3294,29 @@ int parser_test( const wchar_t * buff, arg_count = -1; } - /* - Try to make sure the second argument to 'for' is 'in' - */ - if( wcscmp( cmd, L"for" ) == 0 ) + if( cmd ) { - if( arg_count == 2 ) + + /* + Try to make sure the second argument to 'for' is 'in' + */ + if( wcscmp( cmd, L"for" ) == 0 ) { - if( wcscmp( tok_last( &tok ), L"in" ) != 0 ) + if( arg_count == 2 ) { - err = 1; - - if( out ) + if( wcscmp( tok_last( &tok ), L"in" ) != 0 ) { - error( SYNTAX_ERROR, - tok_get_pos( &tok ), - BUILTIN_FOR_ERR_IN, - L"for" ); + err = 1; - print_errors( out, prefix ); + if( out ) + { + error( SYNTAX_ERROR, + tok_get_pos( &tok ), + BUILTIN_FOR_ERR_IN, + L"for" ); + + print_errors( out, prefix ); + } } } }