cex: fix a crash

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
Unfortunately, this does not fix the crash of test 247, it's unrelated.

commit f3bc4dc154456ecbf0aa7f65c61fbfe25c646452
Author: Akim Demaille <[email protected]>
Date:   Sat May 16 15:21:59 2020 +0200

    cex: fix a crash
    
    * src/state-item.c (init_state_items): If the rule has no reductions
    at all, don't read at all in its list of reduced rules.

diff --git a/src/state-item.c b/src/state-item.c
index a428c875..167e9ac1 100644
--- a/src/state-item.c
+++ b/src/state-item.c
@@ -150,7 +150,7 @@ init_state_items (void)
           state_item_set (sidx, s, s->items[j]);
           state_item *si = state_items + sidx;
           const rule *r = item_rule (si->item);
-          if (red->rules[rule_search_idx] < r)
+          if (rule_search_idx < red->num && red->rules[rule_search_idx] < r)
             ++rule_search_idx;
           if (rule_search_idx < red->num && r == red->rules[rule_search_idx])
             {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.