Add guard against inserting an item after/before itself.

This commit is contained in:
ccd0 2014-11-23 20:28:52 -08:00
parent 55e787931c
commit e8c6403ce6

View File

@ -21,7 +21,7 @@ class RandomAccessList
@length++
before: (root, item) ->
return if item.next is root
return if item.next is root or item is root
@rmi item
@ -35,7 +35,7 @@ class RandomAccessList
@first = item
after: (root, item) ->
return if item.prev is root
return if item.prev is root or item is root
@rmi item