From 05014cb4c999384b26ce9ea49605c0eacd011db5 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 8 Jun 2020 09:12:45 +0200 Subject: [PATCH] Fixed out of bounds crash in HTML converter --- nw/core/tohtml.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/nw/core/tohtml.py b/nw/core/tohtml.py index 282717b3..61541f42 100644 --- a/nw/core/tohtml.py +++ b/nw/core/tohtml.py @@ -312,23 +312,24 @@ class ToHtml(Tokenizer): refTags = [] if theBits[0] in nwLabels.KEY_NAME: retText += " " % nwLabels.KEY_NAME[theBits[0]] - if theBits[0] == nwKeyWords.TAG_KEY: - retText += "%s" % ( - theBits[1], theBits[1] - ) - else: - if self.genMode == self.M_PREVIEW: - for tTag in theBits[1:]: - refTags.append("%s" % ( - theBits[0][1:], tTag, tTag - )) - retText += ", ".join(refTags) + if len(theBits) > 1: + if theBits[0] == nwKeyWords.TAG_KEY: + retText += "%s" % ( + theBits[1], theBits[1] + ) else: - for tTag in theBits[1:]: - refTags.append("%s" % ( - tTag, tTag - )) - retText += ", ".join(refTags) + if self.genMode == self.M_PREVIEW: + for tTag in theBits[1:]: + refTags.append("%s" % ( + theBits[0][1:], tTag, tTag + )) + retText += ", ".join(refTags) + else: + for tTag in theBits[1:]: + refTags.append("%s" % ( + tTag, tTag + )) + retText += ", ".join(refTags) return "