Skip to content

Commit

Permalink
Merge pull request #7875 from m-kuhn/avoidCrashSnapToGrid
Browse files Browse the repository at this point in the history
Fix crash when adding feature to non-spatial layer
  • Loading branch information
m-kuhn committed Sep 13, 2018
2 parents d3ee0f9 + 2182e2d commit 9e40a78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgsmaptooladvanceddigitizing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void QgsMapToolAdvancedDigitizing::canvasReleaseEvent( QgsMapMouseEvent *e )
}

QgsVectorLayer *layer = currentVectorLayer();
if ( mSnapToLayerGridEnabled && layer )
if ( mSnapToGridCanvasItem && mSnapToLayerGridEnabled && layer )
{
e->snapToGrid( layer->geometryFixes()->geometryPrecision(), layer->crs() );
}
Expand All @@ -108,7 +108,7 @@ void QgsMapToolAdvancedDigitizing::canvasMoveEvent( QgsMapMouseEvent *e )
}

QgsVectorLayer *layer = currentVectorLayer();
if ( mSnapToLayerGridEnabled && layer )
if ( mSnapToGridCanvasItem && mSnapToLayerGridEnabled && layer )
{
e->snapToGrid( layer->geometryFixes()->geometryPrecision(), layer->crs() );
mSnapToGridCanvasItem->setPoint( e->mapPoint() );
Expand Down

0 comments on commit 9e40a78

Please sign in to comment.