mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Add a few NULL checks to the codebase to avoid crashes on minor bugs
darcs-hash:20060510115431-ac50b-f6b50fb29b95ff88e7504355aaffef1edcb6739d.gz
This commit is contained in:
parent
786144ba86
commit
4932538c74
2 changed files with 12 additions and 4 deletions
14
parser.c
14
parser.c
|
@ -1173,9 +1173,9 @@ wchar_t *parser_current_line()
|
|||
{
|
||||
int lineno=1;
|
||||
|
||||
const wchar_t *file = parser_current_filename();
|
||||
wchar_t *whole_str = tok_string( current_tokenizer );
|
||||
wchar_t *line = whole_str;
|
||||
const wchar_t *file;
|
||||
wchar_t *whole_str;
|
||||
wchar_t *line;
|
||||
wchar_t *line_end;
|
||||
int i;
|
||||
int offset;
|
||||
|
@ -1183,6 +1183,14 @@ wchar_t *parser_current_line()
|
|||
const wchar_t *function_name=0;
|
||||
int current_line_start=0;
|
||||
|
||||
if( !current_tokenizer )
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
file = parser_current_filename();
|
||||
whole_str = tok_string( current_tokenizer );
|
||||
line = whole_str;
|
||||
|
||||
if( !line )
|
||||
return L"";
|
||||
|
|
|
@ -611,7 +611,7 @@ void tok_next( tokenizer *tok )
|
|||
|
||||
wchar_t *tok_string( tokenizer *tok )
|
||||
{
|
||||
return tok->orig_buff;
|
||||
return tok?tok->orig_buff:0;
|
||||
}
|
||||
|
||||
wchar_t *tok_first( const wchar_t *str )
|
||||
|
|
Loading…
Reference in a new issue