Skip to content

Commit a24e2bd

Browse files
committedMar 6, 2018
Catch a possible exception in QgsGeometry::makeValid
(cherry-picked from b61882f)
1 parent 2345733 commit a24e2bd

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
 

‎src/core/geometry/qgsgeometrymakevalid.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,15 @@ static GEOSGeometry *LWGEOM_GEOS_nodeLines( const GEOSGeometry *lines )
457457
if ( ! point )
458458
return nullptr;
459459

460-
GEOSGeometry *noded = GEOSUnion_r( handle, lines, point );
461-
if ( !noded )
460+
GEOSGeometry *noded = nullptr;
461+
try
462462
{
463-
GEOSGeom_destroy_r( handle, point );
464-
return nullptr;
463+
noded = GEOSUnion_r( handle, lines, point );
464+
}
465+
catch ( GEOSException & )
466+
{
467+
// no need to do anything here - we'll return nullptr anyway
465468
}
466-
467469
GEOSGeom_destroy_r( handle, point );
468470
return noded;
469471
}

‎src/core/qgspallabeling.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,6 +2934,7 @@ QgsGeometry QgsPalLabeling::prepareGeometry( const QgsGeometry &geometry, QgsRen
29342934
QgsGeometry validGeom = geom.makeValid();
29352935
if ( validGeom.isNull() )
29362936
{
2937+
QgsDebugMsg( QString( "Could not repair geometry: %1" ).arg( validGeom.lastError() ) );
29372938
return QgsGeometry();
29382939
}
29392940
geom = validGeom;

0 commit comments

Comments
 (0)