From c3ea8338453233865741b47b186839cecf0d5b96 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sun, 4 Sep 2011 13:05:09 +0200 Subject: [PATCH] check for NULL cps when adjusting. --- C/grow.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/C/grow.c b/C/grow.c index 21b2da3f9..8e8c9e75f 100644 --- a/C/grow.c +++ b/C/grow.c @@ -1216,13 +1216,16 @@ fix_tabling_info( USES_REGS1 ) while (df) { if (DepFr_backchain_cp(df)) DepFr_backchain_cp(df) = ChoicePtrAdjust(DepFr_backchain_cp(df)); - DepFr_leader_cp(df) = ChoicePtrAdjust(DepFr_leader_cp(df)); - DepFr_cons_cp(df) = ConsumerChoicePtrAdjust(DepFr_cons_cp(df)); + if (DepFr_leader_cp(df)) + DepFr_leader_cp(df) = ChoicePtrAdjust(DepFr_leader_cp(df)); + if (DepFr_cons_cp(df)) + DepFr_cons_cp(df) = ConsumerChoicePtrAdjust(DepFr_cons_cp(df)); df = DepFr_next(df); } sg = LOCAL_top_sg_fr; while (sg) { - SgFr_gen_cp(sg) = GeneratorChoicePtrAdjust(SgFr_gen_cp(sg)); + if (SgFr_gen_cp(sg)) + SgFr_gen_cp(sg) = GeneratorChoicePtrAdjust(SgFr_gen_cp(sg)); sg = SgFr_next(sg); } }