Skip to content

Commit 208c920

Browse files
committed
Reject features with empty geometry in QgsMapToolAddFeature
1 parent 7e79302 commit 208c920

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/app/qgsmaptooladdfeature.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
265265
{
266266
QMessageBox::critical( 0, tr( "Error" ), tr( "An error was reported during intersection removal" ) );
267267
}
268+
269+
if ( !f->geometry()->asWkb() ) //avoid intersection might have removed the whole geometry
270+
{
271+
QMessageBox::critical( 0, tr( "Error" ), tr( "The feature cannot be added because it contains an emtpy geometry" ) );
272+
delete f;
273+
stopCapturing();
274+
return;
275+
}
268276
}
269277

270278
vlayer->beginEditCommand( tr( "Feature added" ) );

0 commit comments

Comments
 (0)