from_geojson - catch all exceptions.
This commit is contained in:
parent
dbbf18c752
commit
7caa0cffd4
1 changed files with 9 additions and 1 deletions
|
@ -37,7 +37,15 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry<double> &
|
|||
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;
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue