Skip to content

Commit

Permalink
catch more GEOS exceptions, fixes #802
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@7394 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 13, 2007
1 parent 5732fae commit e61a03c
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2828,31 +2828,30 @@ bool QgsGeometry::intersects(const QgsRect& r)

bool QgsGeometry::intersects(QgsGeometry* geometry)
{
// ensure that both geometries have geos geometry
exportWkbToGeos();
geometry->exportWkbToGeos();

if (!mGeos || !geometry->mGeos)
{
QgsDebugMsg("GEOS geometry not available!");
return false;
}

try // geos might throw exception on error
{
return mGeos->intersects(geometry->mGeos);
// ensure that both geometries have geos geometry
exportWkbToGeos();
geometry->exportWkbToGeos();

if (!mGeos || !geometry->mGeos)
{
QgsDebugMsg("GEOS geometry not available!");
return false;
}

return mGeos->intersects(geometry->mGeos);
}
catch (GEOS_UTIL::TopologyException* e)
catch (GEOS_UTIL::GEOSException &e)
{
#if GEOS_VERSION_MAJOR < 3
QString error = e->toString().c_str();
QString error = e.toString().c_str();
#else
QString error = e->what();
QString error = e.what();
#endif
QgsLogger::warning("GEOS: " + error);
return false;
}

}


Expand Down

0 comments on commit e61a03c

Please sign in to comment.