From cc1f9deac1b671e8d8c4956d8f14ce24bc0fdc9d Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 27 Jul 2023 00:19:15 +0200 Subject: htmlparser: remove stray nil comparison --- src/html/htmlparser.nim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/html') diff --git a/src/html/htmlparser.nim b/src/html/htmlparser.nim index 953552c9..866c9249 100644 --- a/src/html/htmlparser.nim +++ b/src/html/htmlparser.nim @@ -1055,19 +1055,18 @@ proc adoptionAgencyAlgorithm[Handle](parser: var HTML5Parser[Handle], return false if formatting != parser.currentNode: parse_error ELEMENT_NOT_CURRENT_NODE - var furthestBlock: Handle = nil - var furthestBlockIndex: int + var furthestBlockIndex = -1 for j in countdown(parser.openElements.high, 0): if parser.openElements[j] == formatting: break if parser.getTagType(parser.openElements[j]) in SpecialElements: - furthestBlock = parser.openElements[j] furthestBlockIndex = j break - if furthestBlock == nil: + if furthestBlockIndex == -1: while parser.popElement() != formatting: discard parser.activeFormatting.delete(formattingIndex) return false + var furthestBlock = parser.openElements[furthestBlockIndex] let commonAncestor = parser.openElements[stackIndex - 1] var bookmark = formattingIndex var node = furthestBlock -- cgit 1.4.1-2-gfad0