fix bluescreen when playing a file while playlist is empty
[enigma2.git] / lib / python / Components / MediaPlayer.py
index 45551ccc1f368e5a866eaaddb701ab0e653378f8..d88b6280eab661a20e217bf3a429522ba45f2f2d 100644 (file)
@@ -57,13 +57,13 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
                self.list = []
                self.l.setList(self.list)
                self.l.setFont(0, gFont("Regular", 18))
-               self.currPlaying = 0
+               self.currPlaying = -1
                self.oldCurrPlaying = -1
        
        def clear(self):
                del self.list[:]
                self.l.setList(self.list)
-               self.currPlaying = 0
+               self.currPlaying = -1
                self.oldCurrPlaying = -1
 
        GUI_WIDGET = eListbox
@@ -93,7 +93,8 @@ class PlayList(MenuList, HTMLComponent, GUIComponent):
        def updateState(self, state):
                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):