fix crash when nothing is currently playing

This commit is contained in:
Erin 2018-02-25 18:23:04 -06:00
parent 9b2c92afcd
commit c450828721

View file

@ -34,6 +34,10 @@ class NowplayingBot(PineappleBot):
# grab the track from the last.fm api # grab the track from the last.fm api
currently_playing = self.lastfm.get_user(self.config.lastfm_username).get_now_playing() currently_playing = self.lastfm.get_user(self.config.lastfm_username).get_now_playing()
# don't try to post if nothing is being played
if currently_playing is None:
return
# don't repost if we've already posted about this track # don't repost if we've already posted about this track
if currently_playing.__hash__() == self.last_posted_track: if currently_playing.__hash__() == self.last_posted_track:
return return