diff --git a/src/list.cr b/src/list.cr index e57b9c9..11bd1a6 100644 --- a/src/list.cr +++ b/src/list.cr @@ -243,7 +243,7 @@ class DoubleLinkedList(V) if current = @first @first = nil @last = nil - return current.value + return current else raise BrokenList.new "pop a list of 1 element but 'first' is nil" end @@ -251,7 +251,8 @@ class DoubleLinkedList(V) if last = @last @last = last.previous - last.value + @last.not_nil!.next = nil + last else raise BrokenList.new "'last' element is nil despite size > 0" end