Skip to content

Commit 46f208f

Browse files
committed
Merge pull request #98 from lynxlynxlynx/master
a crash fix and a tiny cleanup
2 parents cd509e6 + 974fe95 commit 46f208f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/qgsmaptooladdfeature.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
226226
}
227227
else // polygon
228228
{
229-
QgsGeometry *g;
230229
if ( layerWKBType == QGis::WKBPolygon || layerWKBType == QGis::WKBPolygon25D )
231230
{
232231
g = QgsGeometry::fromPolygon( QgsPolygon() << points().toVector() );
@@ -242,6 +241,11 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
242241
return; //unknown wkbtype
243242
}
244243

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

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

0 commit comments

Comments
 (0)