#453: Using = as Nasal function argument crashes FG

Keep Nasal parser from crashing when "=" function misses a left-hand
element, i.e. when parsing "sin(=)".
(Or do people writing such terrible syntax deserve a crash? ;-) ).
This commit is contained in:
ThorstenB 2011-10-29 21:20:46 +02:00
parent 3477e1a4f5
commit aa0e3e3c9f

View File

@ -536,6 +536,9 @@ static void genAssign(struct Parser* p, struct Token* t)
{
struct Token *lv = LEFT(t), *rv = RIGHT(t);
int len, dummy, var=0;
if (!lv)
naParseError(p, "bad assignment, missing variable", t->line);
else
if(parListLen(lv) || (lv->type == TOK_VAR && parListLen(RIGHT(lv)))) {
if(lv->type == TOK_VAR) { lv = RIGHT(lv); var = 1; }
len = parListLen(lv);