[gnome-music/wip/smcv/issue410] scrobbler: Don't crash if gnome-online-accounts is unavailable
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/smcv/issue410] scrobbler: Don't crash if gnome-online-accounts is unavailable
- Date: Sun, 30 Aug 2020 14:22:54 +0000 (UTC)
commit da026cc26c217540bfa7eb6224d1534869c09aab
Author: Simon McVittie <smcv debian org>
Date: Sun Aug 30 15:17:33 2020 +0100
scrobbler: Don't crash if gnome-online-accounts is unavailable
goa_client_get_manager() can return NULL (in Python,
GoaClient.get_manager() can return None) if the gnome-online-accounts
D-Bus service is not available. last.fm support is not a critical
feature, so the GOA service should not be a hard dependency.
Resolves: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/410
Bug-Debian: https://bugs.debian.org/969271
Signed-off-by: Simon McVittie <smcv debian org>
gnomemusic/scrobbler.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/scrobbler.py b/gnomemusic/scrobbler.py
index 04888594..71f13085 100644
--- a/gnomemusic/scrobbler.py
+++ b/gnomemusic/scrobbler.py
@@ -76,11 +76,15 @@ class GoaLastFM(GObject.GObject):
return
manager = self._client.get_manager()
- try:
- manager.call_is_supported_provider(
- "lastfm", None, self._lastfm_is_supported_cb)
- except TypeError:
- self._log.warning("Error: Unable to check if last.fm is supported")
+
+ if manager is not None:
+ try:
+ manager.call_is_supported_provider(
+ "lastfm", None, self._lastfm_is_supported_cb)
+ except TypeError:
+ self._log.warning("Error: Unable to check if last.fm is supported")
+ else:
+ self._log.info("GNOME Online Accounts not available")
def _lastfm_is_supported_cb(self, proxy, result):
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]