Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash if merge geometries fails
  • Loading branch information
mhugent committed Jun 27, 2013
1 parent 26fbc36 commit b1fe1c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/app/qgisapp.cpp
Expand Up @@ -4765,17 +4765,16 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList&
{
backupPtr = unionGeom;
unionGeom = unionGeom->combine( currentGeom );
if ( !unionGeom )
{
delete backupPtr;
QApplication::restoreOverrideCursor();
return 0;
}
if ( i > 1 ) //delete previous intermediate results
{
delete backupPtr;
backupPtr = 0;
}
if ( !unionGeom )
{
QApplication::restoreOverrideCursor();
return 0;
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsgeometry.cpp
Expand Up @@ -6565,6 +6565,11 @@ QgsGeometry* QgsGeometry::combine( QgsGeometry* geometry )
try
{
GEOSGeometry* unionGeom = GEOSUnion( mGeos, geometry->mGeos );
if ( !unionGeom )
{
return 0;
}

if ( type() == QGis::Line )
{
GEOSGeometry* mergedGeom = GEOSLineMerge( unionGeom );
Expand Down

0 comments on commit b1fe1c3

Please sign in to comment.