Guard against no content type (#7432)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2017-05-03 20:12:51 -07:00
1 parent dbd6f7e4ed
commit c5a91393e4
1 file changed
+3 -2
@@ -916,8 +916,9 @@ def _async_fetch_image(hass, url):
if response.status == 200:
content = yield from response.read()
content_type = response.headers.get(CONTENT_TYPE_HEADER)\
.split(';')[0]
content_type = response.headers.get(CONTENT_TYPE_HEADER)
if content_type:
content_type = content_type.split(';')[0]
except asyncio.TimeoutError:
pass