diff --git a/matsim_visualizer.py b/matsim_visualizer.py index d5b87f8..17100ae 100644 --- a/matsim_visualizer.py +++ b/matsim_visualizer.py @@ -102,7 +102,7 @@ class MatsimVisualizer: current_time = float(event.get('time')) ticked = False - if link_id is not None and event_type is not None and time is not None: + if link_id is not None and event_type is not None and time is not None and any(link['id'] == link_id for link in self._links): if event_type in ['entered link', 'vehicle enters traffic']: self._traffic_per_tick[self._tick][link_id] += 1 ticked = True