Adjust NoteIndexList._index in .index() if it falls off the end of the list.
authorW. Trevor King <wking@drexel.edu>
Thu, 10 Nov 2011 17:12:56 +0000 (12:12 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 10 Nov 2011 17:12:56 +0000 (12:12 -0500)
hooke/playlist.py

index f323ca2b099043875c384e9fcd4831d4288cd495..52d8df1352e6077ae77651512a8eab1305ba3718 100644 (file)
@@ -88,6 +88,8 @@ class NoteIndexList (list):
         is `None`.
         """
         if value == None:
+            if self._index >= len(self):  # perhaps items have been popped
+                self._index = len(self) - 1
             return self._index
         return super(NoteIndexList, self).index(value, *args, **kwargs)