[gnome-music/wip/mschraal/core: 98/118] player: Fix crash when switching albums
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core: 98/118] player: Fix crash when switching albums
- Date: Wed, 26 Jun 2019 13:08:15 +0000 (UTC)
commit b7627fc878817709f164770b590bb8596883cee8
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Jun 23 21:26:54 2019 +0200
player: Fix crash when switching albums
If playing position is > than the new albums amount of songs.
gnomemusic/player.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 0ab3e623..6cd59ec9 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -446,7 +446,9 @@ class PlayerPlaylist(GObject.GObject):
:returns: the song being played or None if there are no songs
:rtype: Grl.Media
"""
- if self._model.get_n_items() != 0:
+ n_items = self._model.get_n_items()
+ if (n_items != 0
+ and n_items > self._position):
current_song = self._model[self._position]
if current_song.props.state == SongWidget.State.PLAYING:
return current_song.props.media
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]