Skip to content

Commit b61882f

Browse files
committed
Catch a possible exception in QgsGeometry::makeValid
1 parent e05a5a9 commit b61882f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/core/geometry/qgsgeometrymakevalid.cpp

+7-5
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

+1
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)