Skip to content

Commit

Permalink
Catch a possible exception in QgsGeometry::makeValid
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 2, 2018
1 parent e05a5a9 commit b61882f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/core/geometry/qgsgeometrymakevalid.cpp
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/core/qgspallabeling.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit b61882f

Please sign in to comment.