mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
Fix remove on last node of singly-linked list [backport:1.6] (#19353)
This commit is contained in:
@@ -739,6 +739,8 @@ proc remove*[T](L: var SinglyLinkedList[T], n: SinglyLinkedNode[T]): bool {.disc
|
||||
if prev.next == nil:
|
||||
return false
|
||||
prev.next = n.next
|
||||
if L.tail == n:
|
||||
L.tail = prev # update tail if we removed the last node
|
||||
true
|
||||
|
||||
proc remove*[T](L: var DoublyLinkedList[T], n: DoublyLinkedNode[T]) =
|
||||
|
||||
Reference in New Issue
Block a user