SpinStabilized / tidbyt-earthquakemap

A Tidbyt app for monitoring global earthquake activity.
Other
2 stars 0 forks source link

[Bug] Not Skipping Display When No Events #15

Closed SpinStabilized closed 1 year ago

SpinStabilized commented 1 year ago

Per @tavdog:

https://github.com/tavdog/tidbyt-apps/commit/5bbbab888c876d938768662cc647be3ab50acff1#commitcomment-104071641

This commit introduced a bug. When no earthequakes are to be displayed earthquake_events list is empty and line 401 ( last_event = earthquake_events[-1] ) triggers Error: index -1 out of range: empty list I'm not sure but I think this might causing the app to display the map even when no events to display exist.

Changing that line to this fixes it I believe : last_event = earthquake_events[-1] if len(earthquake_events) > 0 else None