[gnome-music/wip/mschraal/player-no-play-empty-playlist: 3/3] player: Do not set playing on emtpy playlist
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/player-no-play-empty-playlist: 3/3] player: Do not set playing on emtpy playlist
- Date: Fri, 3 Jan 2020 10:12:16 +0000 (UTC)
commit 1747019ce7aaf7b7f7f5328f24d1747db0f3e1a6
Author: Marinus Schraal <mschraal gnome org>
Date: Fri Jan 3 10:51:35 2020 +0100
player: Do not set playing on emtpy playlist
If the playlist model is empty, do not allow to set a song. This will
result in a crash.
Fixes: #354, #355
gnomemusic/player.py | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 0e23754a..f9b13cb3 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -235,6 +235,9 @@ class PlayerPlaylist(GObject.GObject):
:returns: The selected song
:rtype: CoreSong
"""
+ if self._model.get_n_items() == 0:
+ return None
+
if song is None:
if self.props.repeat_mode == RepeatMode.SHUFFLE:
position = randrange(0, self._model.get_n_items())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]