diff options
author | bptato <nincsnevem662@gmail.com> | 2023-07-27 00:19:15 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-07-27 00:19:15 +0200 |
commit | cc1f9deac1b671e8d8c4956d8f14ce24bc0fdc9d (patch) | |
tree | f226046281f2c67b550c9fff036627a7653aad49 /src | |
parent | fef31da5c9fe39bc3fc07092ee21360850382cdf (diff) | |
download | chawan-cc1f9deac1b671e8d8c4956d8f14ce24bc0fdc9d.tar.gz |
htmlparser: remove stray nil comparison
Diffstat (limited to 'src')
-rw-r--r-- | src/html/htmlparser.nim | 7 |
1 files changed, 3 insertions, 4 deletions
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 |