[gnome-music/wip/mschraal/albumsview-cover-on-demand-fixes: 1/2] albumsview: Fix issue with zero sized covers



commit b5001872147f07b8daa8d91d8a2154593248071a
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Nov 5 16:11:11 2019 +0100

    albumsview: Fix issue with zero sized covers
    
    In some circumstances the AlbumCover size might still be 0x0, triggering
    a division by zero.
    
    Check for AlbumCover size being 0 and stop cover retrieval.

 gnomemusic/views/albumsview.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 7836f86d..76d90efb 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -122,6 +122,9 @@ class AlbumsView(Gtk.Stack):
         top_left_cover = self._flowbox.get_child_at_index(
             nr_cols * (adjustment // (cover_size.height + v_space)))
 
+        if cover_size.width == 0 or cover_size.height == 0:
+            return GLib.SOURCE_REMOVE
+
         covers_col = math.ceil(viewport_size.width / cover_size.width)
         covers_row = math.ceil(viewport_size.height / cover_size.height)
 


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