Skip to content
Permalink
Browse files

Fix crash when deleting last node in a geometry (fix #13674)

(cherry-picked from ba1de8b)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 8b7ab57 commit 1449078c6056b7338163e637e69eb0eb28ae6638
Showing with 16 additions and 1 deletion.
  1. +9 −1 src/app/nodetool/qgsmaptoolnodetool.cpp
  2. +7 −0 src/core/qgsvectorlayereditutils.cpp
@@ -539,7 +539,15 @@ void QgsMapToolNodeTool::keyPressEvent( QKeyEvent* e )
return;

mSelectedFeature->deleteSelectedVertexes();
safeSelectVertex( firstSelectedIndex );

if ( mSelectedFeature->geometry()->isEmpty() )
{
emit messageEmitted( tr( "Geometry has been cleared. Use the add part tool to set geometry for this feature." ) );
}
else
{
safeSelectVertex( firstSelectedIndex );
}
mCanvas->refresh();

// Override default shortcut management in MapCanvas
@@ -103,6 +103,13 @@ bool QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId atFeatureId, int atVert
if ( !geometry.deleteVertex( atVertex ) )
return false;

if ( geometry.geometry() && geometry.geometry()->nCoordinates() == 0 )
{
//last vertex deleted, set geometry to null
geometry.setGeometry( 0 );
}


L->editBuffer()->changeGeometry( atFeatureId, &geometry );
return true;
}

0 comments on commit 1449078

Please sign in to comment.
You can’t perform that action at this time.