fixed "list index out of range" error when getting track url

This commit is contained in:
RemixDev 2021-12-19 18:07:10 +01:00
parent d6a0cb2c74
commit 3f558db4ab
No known key found for this signature in database
GPG key ID: B33962B465BDB51C

View file

@ -190,7 +190,7 @@ class Deezer:
result.append(WrongGeolocation(self.current_user['country']))
else:
result.append(DeezerError(json.dumps(response)))
if 'media' in data:
if 'media' in data and len(data['media']):
result.append(data['media'][0]['sources'][0]['url'])
else:
result.append(None)