Skip to content
Permalink
Browse files

Catch a possible exception in QgsGeometry::makeValid

(cherry-picked from b61882f)
  • Loading branch information
nyalldawson committed Feb 27, 2018
1 parent 2345733 commit a24e2bd3de7ab8166d7c6eedb74cd8ae69cd2794
Showing with 8 additions and 5 deletions.
  1. +7 −5 src/core/geometry/qgsgeometrymakevalid.cpp
  2. +1 −0 src/core/qgspallabeling.cpp
@@ -457,13 +457,15 @@ static GEOSGeometry *LWGEOM_GEOS_nodeLines( const GEOSGeometry *lines )
if ( ! point )
return nullptr;

GEOSGeometry *noded = GEOSUnion_r( handle, lines, point );
if ( !noded )
GEOSGeometry *noded = nullptr;
try
{
GEOSGeom_destroy_r( handle, point );
return nullptr;
noded = GEOSUnion_r( handle, lines, point );
}
catch ( GEOSException & )
{
// no need to do anything here - we'll return nullptr anyway
}

GEOSGeom_destroy_r( handle, point );
return noded;
}
@@ -2934,6 +2934,7 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry &geometry, QgsRen
QgsGeometry validGeom = geom.makeValid();
if ( validGeom.isNull() )
{
QgsDebugMsg( QString( "Could not repair geometry: %1" ).arg( validGeom.lastError() ) );
return QgsGeometry();
}
geom = validGeom;

0 comments on commit a24e2bd

Please sign in to comment.
You can’t perform that action at this time.