From: W. Trevor King Date: Thu, 10 Nov 2011 17:12:56 +0000 (-0500) Subject: Adjust NoteIndexList._index in .index() if it falls off the end of the list. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=034303a42d8375bb4fbf9c51e62e204305f6a91a;p=hooke.git Adjust NoteIndexList._index in .index() if it falls off the end of the list. --- diff --git a/hooke/playlist.py b/hooke/playlist.py index f323ca2..52d8df1 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -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)