From 4984030871e4eb43f62c9b94dde35b85a7d250d7 Mon Sep 17 00:00:00 2001 From: Lukas Barth Date: Wed, 12 Dec 2018 16:11:18 +0100 Subject: [PATCH] Fix geizhals crash if no price found (#19197) * Fix geizhals crash if no price found * Return None on unknown price. * Linting * Linting the linting --- homeassistant/components/sensor/geizhals.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/sensor/geizhals.py b/homeassistant/components/sensor/geizhals.py index 654ad0ccafb..66cab473f49 100644 --- a/homeassistant/components/sensor/geizhals.py +++ b/homeassistant/components/sensor/geizhals.py @@ -80,6 +80,9 @@ class Geizwatch(Entity): @property def state(self): """Return the best price of the selected product.""" + if not self._device.prices: + return None + return self._device.prices[0] @property