From 9e741cfe30d80cb6ff60843a0335eac8e9616844 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 5 Apr 2013 09:11:24 +0000 Subject: [PATCH] a bugfix which was causing an infinite loop in the C linearizer for some sentences --- src/runtime/c/pgf/linearizer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/linearizer.c b/src/runtime/c/pgf/linearizer.c index 4f3bee0a0..55249741c 100644 --- a/src/runtime/c/pgf/linearizer.c +++ b/src/runtime/c/pgf/linearizer.c @@ -408,6 +408,11 @@ pgf_cnc_tree_enum_next(GuEnum* self, void* to, GuPool* pool) PgfLzn* lzn = gu_container(self, PgfLzn, en); PgfCncTree* toc = to; + if (lzn->ch == NULL) { + *toc = gu_null_variant; + return; + } + GuChoiceMark mark = gu_choice_mark(lzn->ch); *toc = pgf_lzn_resolve(lzn, lzn->expr, NULL, pool); gu_choice_reset(lzn->ch, mark); @@ -426,7 +431,9 @@ pgf_cnc_tree_enum_next(GuEnum* self, void* to, GuPool* pool) gu_pool_free(tmp_pool); #endif - gu_choice_advance(lzn->ch); + if (!gu_choice_advance(lzn->ch)) { + lzn->ch = NULL; + } } PgfCncTreeEnum*