mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-30 18:41:45 +00:00
Fix remove on last node of singly-linked list [backport:1.6] (#19353)
(cherry picked from commit 955040f0f1)
This commit is contained in:
@@ -740,6 +740,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