WinHelp backend segfaults when it finds a nonexistent cross-
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 9 Jan 2003 12:04:01 +0000 (12:04 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 9 Jan 2003 12:04:01 +0000 (12:04 +0000)
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

index a8cb99e..f4b1b2d 100644 (file)
--- 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: