From 427d7ee1fc430e94041a5888b47ff8e4867f41ba Mon Sep 17 00:00:00 2001 From: Tom Matheussen Date: Thu, 17 Aug 2017 22:39:20 +0200 Subject: [PATCH] Check if album image(s) exist in spotify (#9024) * Check if album image(s) exist in spotify * Actually set the image to None * Simplified using ternary operator --- homeassistant/components/media_player/spotify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/media_player/spotify.py b/homeassistant/components/media_player/spotify.py index 80d18b8eea8..239b13a6292 100644 --- a/homeassistant/components/media_player/spotify.py +++ b/homeassistant/components/media_player/spotify.py @@ -185,7 +185,8 @@ class SpotifyMediaPlayer(MediaPlayerDevice): self._artist = ', '.join([artist.get('name') for artist in item.get('artists')]) self._uri = current.get('uri') - self._image_url = item.get('album').get('images')[0].get('url') + images = item.get('album').get('images') + self._image_url = images[0].get('url') if images else None # Playing state self._state = STATE_PAUSED if current.get('is_playing'):