Skip to content

Commit

Permalink
Fix uncaught exception when sign-in does not succeed anxdpanic#985
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Nov 18, 2024
1 parent c2bc80a commit f8ec610
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions resources/lib/youtube_plugin/kodion/json_store/access_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,12 @@ def update_access_token(self,
}

if expiry is not None:
details['token_expires'] = time.time() + (
min(map(int, [val for val in expiry if val]))
if isinstance(expiry, (list, tuple)) else
int(expiry)
)
if isinstance(expiry, (list, tuple)):
expiry = [val for val in expiry if val]
expiry = min(map(int, expiry)) if expiry else -1
else:
expiry = int(expiry)
details['token_expires'] = time.time() + expiry

if refresh_token is not None:
details['refresh_token'] = (
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/youtube/helper/yt_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _do_login(token_type):

tokens = ['tv', 'personal']
for token_type, token in enumerate(tokens):
new_token = _do_login(token_type) or (None, 0, None)
new_token = _do_login(token_type) or ('', -1, '')
tokens[token_type] = new_token

context.log_debug('YouTube Login:'
Expand Down

0 comments on commit f8ec610

Please sign in to comment.