[gnome-music/wip/mschraal/coremodel-playlist-date-sort-crash] coremodel: Fix playlist sorting crash




commit ea3ec405007f72d09e01d45bfd32054d81e3f3ca
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Oct 12 21:07:21 2020 +0200

    coremodel: Fix playlist sorting crash
    
    Due to a bug in Grilo 0.3.12 Tracker3 plugin, playlists do not have a
    creation date set, ignore the missing creation date while sorting.
    
    Fixes: #417

 gnomemusic/coremodel.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 7d8f8173e..77e2bc762 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -183,6 +183,10 @@ class CoreModel(GObject.GObject):
         if playlist_b.props.is_smart:
             return 1
 
+        if (playlist_a.props.creation_date is None
+                or playlist_b.props.creation_date is None):
+            return 0
+
         # cannot use GLib.DateTime.compare
         # https://gitlab.gnome.org/GNOME/pygobject/issues/334
         # newest first


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