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




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

    coremodel: Fix playlist sorting crash
    
    Some playlists may not have a creation date set, ignore them while
    sorting.
    
    Fixes: #417

 gnomemusic/coremodel.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 7d8f8173..77e2bc76 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]