Skip to content

Commit

Permalink
fixed crash when trying to add features with invalid geometry
Browse files Browse the repository at this point in the history
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 d5ca555
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/qgsmaptooladdfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d5ca555

Please sign in to comment.