diff options
| author | Simon Tatham <anakin@pobox.com> | 2014-12-16 11:48:08 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2014-12-16 11:54:49 +0000 |
| commit | 36105490740922d350e1488c4a7534282a24b1ac (patch) | |
| tree | 40ddaff136db40630412673eb64f580eedfbedf1 | |
| parent | f5f155b9661b4e6579efbce191e155aaab8aa7c1 (diff) | |
| download | halibut-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.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -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: |