summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2014-12-16 11:48:08 +0000
committerSimon Tatham <anakin@pobox.com>2014-12-16 11:54:49 +0000
commit36105490740922d350e1488c4a7534282a24b1ac (patch)
tree40ddaff136db40630412673eb64f580eedfbedf1
parentf5f155b9661b4e6579efbce191e155aaab8aa7c1 (diff)
downloadhalibut-36105490740922d350e1488c4a7534282a24b1ac.zip
halibut-36105490740922d350e1488c4a7534282a24b1ac.tar.gz
halibut-36105490740922d350e1488c4a7534282a24b1ac.tar.bz2
halibut-36105490740922d350e1488c4a7534282a24b1ac.tar.xz
Remove an overzealous assertion in HTML href processing.
Turns out we can get a null pointer passed through from the front end, if the input file was erroneous in some way, so we should do fallback processing if so (exactly what doesn't matter much) rather than crash.
-rw-r--r--bk_html.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/bk_html.c b/bk_html.c
index f7ae7cf..a27108f 100644
--- a/bk_html.c
+++ b/bk_html.c
@@ -2244,13 +2244,23 @@ static void html_words(htmloutput *ho, word *words, int flags,
paragraph *p;
htmlsect *s;
- assert(kwl);
- p = kwl->para;
- s = (htmlsect *)p->private_data;
-
- assert(s);
-
- html_href(ho, file, s->file, s->fragments[0]);
+ /* kwl should be non-NULL in any sensible case, but if the
+ * input contained an unresolvable xref then it might be
+ * NULL as an after-effect of that */
+ if (kwl) {
+ p = kwl->para;
+ s = (htmlsect *)p->private_data;
+
+ assert(s);
+
+ html_href(ho, file, s->file, s->fragments[0]);
+ } else {
+ /* If kwl is NULL, we must still open an href to
+ * _somewhere_, because it's easier than remembering
+ * which one not to close when we come to the
+ * XrefEnd */
+ html_href(ho, file, file, NULL);
+ }
}
break;
case word_HyperEnd: