Skip to content
Permalink
Browse files

Catch a possible exception in QgsGeometry::makeValid

  • Loading branch information
nyalldawson committed Mar 2, 2018
1 parent e05a5a9 commit b61882f2f4eb29b19ac98612333ed8f749d41ccc
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 b61882f

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