Guard against no content type ()

This commit is contained in:
Paulus Schoutsen 2017-05-03 20:12:51 -07:00 committed by GitHub
parent dbd6f7e4ed
commit c5a91393e4

View file

@ -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