Skip to content

Commit

Permalink
Fix error in case no positions
Browse files Browse the repository at this point in the history
  • Loading branch information
vingerha committed Nov 18, 2023
1 parent 9e78a23 commit c3c55b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/gtfs2/gtfs_rt_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ def get_next_services(self):
if len(next_services) > 0
else "-"
)
if next_services[0].position[0]:
attrs[ATTR_LATITUDE] = next_services[0].position[0][1]
attrs[ATTR_LONGITUDE] = next_services[0].position[0][0]
if next_services[0].position:
if next_services[0].position[0]:
attrs[ATTR_LATITUDE] = next_services[0].position[0][1]
attrs[ATTR_LONGITUDE] = next_services[0].position[0][0]
if len(next_services) > 1:
attrs[ATTR_NEXT_UP] = (
next_services[1].arrival_time.strftime(TIME_STR_FORMAT)
Expand Down

0 comments on commit c3c55b1

Please sign in to comment.