From: Martin Mares Date: Wed, 1 Apr 2015 14:11:51 +0000 (+0200) Subject: Do not crash on broken multipolygons X-Git-Url: http://mj.ucw.cz/gitweb/?p=leo.git;a=commitdiff_plain;h=0f3504cdb01d0a0a1e9151013c3ff83a61a0b28b Do not crash on broken multipolygons --- diff --git a/osm.c b/osm.c index 862f7fb..a9c499e 100644 --- a/osm.c +++ b/osm.c @@ -382,7 +382,7 @@ static void mpg_walk_boundary(struct osm_multipolygon *m, bool inner) clist_init(&b->nodes); struct mpg_vertex *w = v; - while (!w->visited) + while (w && !w->visited) { w->visited = 1; struct osm_ref *f = mp_alloc(osm_this->pool, sizeof(*f)); @@ -412,7 +412,9 @@ static void mpg_walk_boundary(struct osm_multipolygon *m, bool inner) w = dest; } - if (w != v) + if (!w) + osm_obj_warn(&mpg_current->o, "Boundary not closed"); + else if (w != v) osm_obj_warn(&mpg_current->o, "Boundary not closed at node %ju", (uintmax_t) w->o->id); struct osm_ref *f = mp_alloc(osm_this->pool, sizeof(*f));