thunner
thunner copied to clipboard
empty playlists result in 'TypeError: list indices must be integers, not str'
If a user has no playlists, the app will crash with the error
TypeError: list indices must be integers, not str
This can be avoided by changing the line
playlists = list_playlists(api,playlist_ids)
with an if loop:
if len(playlist_ids) > 0:
playlists = list_playlists(api,playlist_ids)
else:
playlists = [{'subtreeline': 0, 'name': 'pid', 'subtree': 0}]
This results however in the error:
s = (str(song['track']) if 'track' in song else 'x') + '. ' + song['name']
KeyError: 'name'