Fix a rare crash in the new LTN cell drawing

This commit is contained in:
Dustin Carlino 2022-07-11 15:52:52 +01:00
parent cc9687b7d6
commit 46df90a238
2 changed files with 6 additions and 0 deletions

View File

@ -262,6 +262,11 @@ fn setup_editing(
// Highlight cell areas and their border areas when hovered
for (idx, polygons) in render_cells.polygons_per_cell.iter().enumerate() {
// Edge case happening near https://www.openstreetmap.org/way/106879596
if polygons.is_empty() {
continue;
}
let mut batch = GeomBatch::new();
batch.extend(Color::YELLOW.alpha(0.1), polygons.clone());
for arrow in neighbourhood.cells[idx].border_arrows(app) {

View File

@ -10,6 +10,7 @@ use crate::{colors, Neighbourhood};
const RESOLUTION_M: f64 = 10.0;
pub struct RenderCells {
/// Rarely, this might be empty if the area is very small
pub polygons_per_cell: Vec<Vec<Polygon>>,
/// Colors per cell, such that adjacent cells are colored differently
pub colors: Vec<Color>,