Skip to content

Commit b1fe1c3

Browse files
committed
Fix crash if merge geometries fails
1 parent 26fbc36 commit b1fe1c3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/app/qgisapp.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -4765,17 +4765,16 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
47654765
{
47664766
backupPtr = unionGeom;
47674767
unionGeom = unionGeom->combine( currentGeom );
4768-
if ( !unionGeom )
4769-
{
4770-
delete backupPtr;
4771-
QApplication::restoreOverrideCursor();
4772-
return 0;
4773-
}
47744768
if ( i > 1 ) //delete previous intermediate results
47754769
{
47764770
delete backupPtr;
47774771
backupPtr = 0;
47784772
}
4773+
if ( !unionGeom )
4774+
{
4775+
QApplication::restoreOverrideCursor();
4776+
return 0;
4777+
}
47794778
}
47804779
}
47814780

src/core/qgsgeometry.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -6565,6 +6565,11 @@ QgsGeometry* QgsGeometry::combine( QgsGeometry* geometry )
65656565
try
65666566
{
65676567
GEOSGeometry* unionGeom = GEOSUnion( mGeos, geometry->mGeos );
6568+
if ( !unionGeom )
6569+
{
6570+
return 0;
6571+
}
6572+
65686573
if ( type() == QGis::Line )
65696574
{
65706575
GEOSGeometry* mergedGeom = GEOSLineMerge( unionGeom );

0 commit comments

Comments
 (0)