Skip to content

Commit d5ca555

Browse files
committed
fixed crash when trying to add features with invalid geometry
QgsMapToolAddFeature::canvasReleaseEvent wasn't checking if geos returned a sane geometry. One simple way of triggering the crash is to click twice on the same point and then complete the op by rightclicking. Of course this is not a real polygon, so things went haywire after that.
1 parent cd509e6 commit d5ca555

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/app/qgsmaptooladdfeature.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
242242
return; //unknown wkbtype
243243
}
244244

245+
if ( !g )
246+
{
247+
stopCapturing();
248+
return; // invalid geometry; one possibility is from duplicate points
249+
}
245250
f->setGeometry( g );
246251

247252
int avoidIntersectionsReturn = f->geometry()->avoidIntersections();

0 commit comments

Comments
 (0)