Skip to content

Commit

Permalink
Handle the case where the language definition references a non-exista…
Browse files Browse the repository at this point in the history
…nt rule, and ensure it fails with 'Unknown Parser'
  • Loading branch information
seusher committed Nov 8, 2016
1 parent 37c12b1 commit 71af074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3264,7 +3264,7 @@ static mpc_parser_t *mpca_grammar_find_parser(char *x, mpca_grammar_st_t *st) {
st->parsers = realloc(st->parsers, sizeof(mpc_parser_t*) * st->parsers_num);
st->parsers[st->parsers_num-1] = p;

if (p == NULL) { return mpc_failf("Unknown Parser '%s'!", x); }
if (p == NULL || p->name == NULL) { return mpc_failf("Unknown Parser '%s'!", x); }
if (p->name && strcmp(p->name, x) == 0) { return p; }

}
Expand Down

0 comments on commit 71af074

Please sign in to comment.