From 7cf305b7b9110585d31cdaad8de89411c688a465 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 9 Jan 2003 12:04:01 +0000 Subject: [PATCH] WinHelp backend segfaults when it finds a nonexistent cross- reference. (The broken link will already have been reported in the mid-end, but this won't inhibit output generation, so the onus is still on us to at the very least not go *crash*.) git-svn-id: svn://svn.tartarus.org/sgt/halibut@2507 cda61777-01e9-0310-a592-d414129be87e --- bk_whlp.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/bk_whlp.c b/bk_whlp.c index a8cb99e..f4b1b2d 100644 --- a/bk_whlp.c +++ b/bk_whlp.c @@ -479,22 +479,25 @@ static void whlp_mkparagraph(struct bk_whlp_state *state, case word_LowerXref: if (subsidiary) break; /* disabled in subsidiary bits */ kwl = kw_lookup(state->keywords, text->text); - assert(xref_target == NULL); - if (kwl->para->type == para_NumberedList) { - break; /* don't xref to numbered list items */ - } else if (kwl->para->type == para_BiblioCited) { - /* - * An xref to a bibliography item jumps to the section - * containing it. - */ - if (kwl->para->parent) - xref_target = kwl->para->parent; - else - break; - } else { - xref_target = kwl->para; - } - whlp_start_hyperlink(state->h, (WHLP_TOPIC)xref_target->private_data); + assert(xref_target == NULL); + if (kwl) { + if (kwl->para->type == para_NumberedList) { + break; /* don't xref to numbered list items */ + } else if (kwl->para->type == para_BiblioCited) { + /* + * An xref to a bibliography item jumps to the section + * containing it. + */ + if (kwl->para->parent) + xref_target = kwl->para->parent; + else + break; + } else { + xref_target = kwl->para; + } + whlp_start_hyperlink(state->h, + (WHLP_TOPIC)xref_target->private_data); + } break; case word_XrefEnd: -- 2.11.0