mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 22:13:27 +03:00
Fix a rare crash in the LTN tool drawing diagonal filters
This commit is contained in:
parent
717e97ccd1
commit
c79c2d913c
@ -369,7 +369,15 @@ impl DiagonalFilter {
|
||||
// road
|
||||
let pt1 = pl1.must_shift_right(r1.get_half_width()).last_pt();
|
||||
let pt2 = pl2.must_shift_left(r2.get_half_width()).last_pt();
|
||||
Line::must_new(pt1, pt2)
|
||||
match Line::new(pt1, pt2) {
|
||||
Ok(line) => line,
|
||||
// Very rarely, this line is too small. If that happens, just draw something roughly in
|
||||
// the right place
|
||||
Err(_) => Line::must_new(
|
||||
pt1,
|
||||
pt1.project_away(r1.get_half_width(), pt1.angle_to(pt2)),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn allows_turn(&self, from: RoadID, to: RoadID) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user