Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 9d39c92d573fcb9ae1f0c339f34d139b > files > 3

whaawmp-0.2.12.1-6.fc15.src.rpm

--- src/gui/main.py	2009-07-15 08:21:08.000000000 +0200
+++ src/gui/main.py2	2009-11-21 14:40:20.736483935 +0100
@@ -370,9 +370,11 @@
 	def playNext(self, widget=None, stop=True):
 		## Plays the next file in the queue (if it exists).
 		if (self.wTree.get_object("mnuiRandom").get_active()):
-			# If random is set, pick a random item from the queue.
-			# -1 because randint includes boundaries.
-			filename = queue.getTrackRemove(randint(0, queue.length()-1))
+			# If queue is empty randint(0,-1) will crash
+			if queue:
+				# If random is set, pick a random item from the queue.
+				# -1 because randint includes boundaries.
+				filename = queue.getTrackRemove(randint(0, queue.length()-1))
 		else:
 			# Otherwise just get the next item.
 			filename = queue.getNextTrackRemove()