Skip to content

Commit

Permalink
Safer check
Browse files Browse the repository at this point in the history
  • Loading branch information
thibmaek committed Dec 10, 2018
1 parent 120172c commit e1b00f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions homeassistant/components/sensor/nmbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ def unit_of_measurement(self):
@property
def icon(self):
"""Return the sensor default icon or an alert icon if any delay."""
delay = get_delay_in_minutes(self._attrs['departure']['delay'])
if self._attrs is not None and delay > 0:
return "mdi:alert-octagon"
if self._attrs is not None:
delay = get_delay_in_minutes(self._attrs['departure']['delay'])
if delay > 0:
return "mdi:alert-octagon"

return "mdi:train"

Expand Down

0 comments on commit e1b00f1

Please sign in to comment.