quick fix to the crashing chokepoints plugin
@@ -55,7 +55,9 @@ fn find_chokepoints(sim: &Sim) -> ChokepointsFinder {
let active = sim.active_agents();
info!("Finding chokepoints from {} active agents", active.len());
for a in active.into_iter() {
- for step in sim.get_path(a).unwrap().get_steps() {
+ // Why would an active agent not have a path? Pedestrian riding a bus.
+ if let Some(path) = sim.get_path(a) {
+ for step in path.get_steps() {
match step {
PathStep::Lane(l) | PathStep::ContraflowLane(l) => {
count_per_lane.update(vec![*l]);
@@ -66,6 +68,7 @@ fn find_chokepoints(sim: &Sim) -> ChokepointsFinder {
}
}
}
+ }
let lanes: HashSet<LaneID> = count_per_lane
.most_common_ordered()
