Fix NULL dereference when function name is not specified

It was possible to type `function ""; end`, and this caused fish to
crash because of NULL pointer.
This commit is contained in:
Konrad Borowski 2014-05-06 12:07:16 +02:00
parent 16534ec644
commit 13e1e7e1e9

View file

@ -2002,6 +2002,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr
else if (! wcslen(argv[woptind])) else if (! wcslen(argv[woptind]))
{ {
append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]); append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]);
res=1;
} }
else else
{ {