Skip to content

Commit

Permalink
compare before decrementing
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-parmar committed Oct 31, 2024
1 parent 329eb68 commit e68988b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eth/rlp/writer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ proc maybeClosePendingLists(self: var RlpWriter) =
let lastListIdx = self.pendingLists.len - 1
doAssert self.pendingLists[lastListIdx].remainingItems > 0

self.pendingLists[lastListIdx].remainingItems -= 1
# if one last item is remaining in the list
if self.pendingLists[lastListIdx].remainingItems == 0:
if self.pendingLists[lastListIdx].remainingItems == 1:
# A list have been just finished. It was started in `startList`.
let listStartPos = self.pendingLists[lastListIdx].startPos
self.pendingLists[lastListIdx].remainingItems -= 1
self.pendingLists.setLen lastListIdx

# How many bytes were written since the start?
Expand Down

0 comments on commit e68988b

Please sign in to comment.