fix bluescreen when playing a file while playlist is empty
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 13 Nov 2006 01:16:45 +0000 (01:16 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 13 Nov 2006 01:16:45 +0000 (01:16 +0000)
lib/python/Components/MediaPlayer.py

index b2cb4eb..d88b628 100644 (file)
@@ -63,7 +63,7 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
        def clear(self):
                del self.list[:]
                self.l.setList(self.list)
        def clear(self):
                del self.list[:]
                self.l.setList(self.list)
-               self.currPlaying = 0
+               self.currPlaying = -1
                self.oldCurrPlaying = -1
 
        GUI_WIDGET = eListbox
                self.oldCurrPlaying = -1
 
        GUI_WIDGET = eListbox
@@ -91,11 +91,10 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
                self.currPlaying = index
        
        def updateState(self, state):
                self.currPlaying = index
        
        def updateState(self, state):
-               if self.currPlaying == -1:
-                       return
                if len(self.list) > self.oldCurrPlaying and self.oldCurrPlaying != -1:
                        self.list[self.oldCurrPlaying] = PlaylistEntryComponent(self.list[self.oldCurrPlaying][0], STATE_NONE)
                if len(self.list) > self.oldCurrPlaying and self.oldCurrPlaying != -1:
                        self.list[self.oldCurrPlaying] = PlaylistEntryComponent(self.list[self.oldCurrPlaying][0], STATE_NONE)
-               self.list[self.currPlaying] = PlaylistEntryComponent(self.list[self.currPlaying][0], state)
+               if self.currPlaying != -1 and self.currPlaying < len(self.list):
+                       self.list[self.currPlaying] = PlaylistEntryComponent(self.list[self.currPlaying][0], state)
                self.updateList()
 
        def playFile(self):
                self.updateList()
 
        def playFile(self):