[gnome-music/wip/mschraal/scrobbling-crash-fix: 2/2] scrobbler: Fix empty coresong crash




commit 24bbce685b2b27beccb8e38a73ea5ff76eb60755
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Sep 22 16:25:58 2020 +0200

    scrobbler: Fix empty coresong crash
    
    It is possible for the coresong as passed by Player to be None.
    LastFmScrobbler does not handle this and crashes.
    
    Add a check for None to now_playing() only as it is always called before
    scrobble().
    
    Related: #412

 gnomemusic/scrobbler.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/scrobbler.py b/gnomemusic/scrobbler.py
index c6f7defe..857a7580 100644
--- a/gnomemusic/scrobbler.py
+++ b/gnomemusic/scrobbler.py
@@ -444,6 +444,9 @@ class LastFmScrobbler(GObject.GObject):
         """
         self.props.scrobbled = False
 
+        if coresong is None:
+            return
+
         if not self.props.can_scrobble:
             return
 


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