[gnome-music/wip/mschraal/albumsview-cover-on-demand-fixes: 2/2] albumsview: Fix crash on empty view



commit 07a35322a427b7c936124f0a5fba86a2e5eeea3b
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Nov 6 10:29:28 2019 +0100

    albumsview: Fix crash on empty view
    
    _retrieve_covers could be triggered while no covers were available, this
    resulted in a crash.
    
    Only start retrieving covers when the list is not empty.

 gnomemusic/views/albumsview.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 76d90efb..f520465f 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -111,6 +111,9 @@ class AlbumsView(Gtk.Stack):
             return GLib.SOURCE_CONTINUE
 
         first_cover = self._flowbox.get_child_at_index(0)
+        if first_cover is None:
+            return GLib.SOURCE_REMOVE
+
         cover_size, _ = first_cover.get_allocated_size()
         viewport_size, _ = self._viewport.get_allocated_size()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]