From 7caa0cffd453646bfe040dcb8f2bfcfa53603834 Mon Sep 17 00:00:00 2001 From: artemp Date: Wed, 22 Mar 2017 15:06:34 +0000 Subject: [PATCH] from_geojson - catch all exceptions. --- src/json/mapnik_json_geometry_parser.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/json/mapnik_json_geometry_parser.cpp b/src/json/mapnik_json_geometry_parser.cpp index 278d2c4be..a517e867e 100644 --- a/src/json/mapnik_json_geometry_parser.cpp +++ b/src/json/mapnik_json_geometry_parser.cpp @@ -37,7 +37,15 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry & standard::space_type space; char const* start = json.c_str(); char const* end = start + json.length(); - return qi::phrase_parse(start, end, g, space, geom); + try + { + if (!qi::phrase_parse(start, end, g, space, geom)) + { + throw std::runtime_error("Can't parser GeoJSON Geometry"); + } + } + catch (...) { return false; } + return true; } }}