Fix getting now playing for user with no scrobbles. Closes #81.

This commit is contained in:
hugovk 2014-03-01 16:57:29 +02:00
parent f59d2cc680
commit 16079468ab
2 changed files with 18 additions and 3 deletions

View file

@ -3002,7 +3002,12 @@ class User(_BaseObject):
doc = self._request('user.getRecentTracks', False, params)
e = doc.getElementsByTagName('track')[0]
tracks = doc.getElementsByTagName('track')
if len(tracks) == 0:
return None
e = tracks[0]
if not e.hasAttribute('nowplaying'):
return None