Skip to content
Permalink
Browse files
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.
  • Loading branch information
lynxlynxlynx committed Feb 17, 2012
1 parent cd509e6 commit d5ca5554c30b94083e78e0e26c2f0435e66c0726
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/app/qgsmaptooladdfeature.cpp
@@ -242,6 +242,11 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
return; //unknown wkbtype
}

if ( !g )
{
stopCapturing();
return; // invalid geometry; one possibility is from duplicate points
}
f->setGeometry( g );

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

0 comments on commit d5ca555

Please sign in to comment.