From 64ba1377ff80764c7787e656042787d38c008aeb Mon Sep 17 00:00:00 2001 From: Marin Tsanov Date: Tue, 23 Aug 2022 02:20:32 +0300 Subject: [PATCH] Fix configuration error when connecting to Spotify for the first time When there was no .cache file, it had to ask Spotify for the tokens. However, since the token_info was None, it tried accessing something that never existed in the first place and failed with "Configuration error: Test connection to Spotify API failed: 'NoneType' object is not subscriptable" --- src/youspotube/api/spotify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/youspotube/api/spotify.py b/src/youspotube/api/spotify.py index 703d1bd..9124b29 100644 --- a/src/youspotube/api/spotify.py +++ b/src/youspotube/api/spotify.py @@ -19,7 +19,7 @@ def connection(self): # _init_connection should have been called in order to be able to use this property auth_manager = self.spotify.auth_manager token_info = auth_manager.cache_handler.get_cached_token() - if auth_manager.is_token_expired(token_info): + if token_info is not None and auth_manager.is_token_expired(token_info): self._init_connection() return self.spotify