diff options
author | 2006-09-08 06:15:59 +1000 | |
---|---|---|
committer | 2006-09-08 06:15:59 +1000 | |
commit | 72d73b7fddadf610b5c26ab65db982e91a0f6595 (patch) | |
tree | 5d8fa53229e38b5113fe98498e75193e9ea925ed /parser.c | |
parent | 227a5da02ca252f95427997cb46e042c2be09f99 (diff) |
Fix crash bug in cyntax validator when using an illegal command name. Thanks to Martin Bähr for the report.
darcs-hash:20060907201559-ac50b-34fa01bbc40eafddcc64a5111bebd88aab75a8d4.gz
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -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 ); + } } } } |