From d97abb07637c7665413ee38357e257ac04367571 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 6 Mar 1989 18:48:30 +0000 Subject: [PATCH] avoid null-reference if some nonterminal is not defined --- util/LLgen/src/reach.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/LLgen/src/reach.c b/util/LLgen/src/reach.c index 3fa5110da..5bc3e7c17 100644 --- a/util/LLgen/src/reach.c +++ b/util/LLgen/src/reach.c @@ -35,7 +35,6 @@ STATIC reachwalk(); co_reach() { /* * Check for undefined or unreachable nonterminals. - * An undefined nonterminal is a fatal error! */ register p_nont p; register p_start st; @@ -50,6 +49,7 @@ co_reach() { p->n_name); } } + /* * Walk the grammar rules, starting with the startsymbols * Mark the nonterminals that are encountered with the flag @@ -106,7 +106,7 @@ reachwalk(p) register p_gram p; { register p_nont n = &nonterms[g_getcont(p)]; reachable(n); - if (g_gettype(n->n_rule) == EORULE && + if (p->n_rule && g_gettype(n->n_rule) == EORULE && ! g_getnpar(p) && (getntparams(n) == 0)) { register p_gram np = p; do { -- 2.34.1