Skip to content
Permalink
Browse files

Merge pull request #7875 from m-kuhn/avoidCrashSnapToGrid

Fix crash when adding feature to non-spatial layer
  • Loading branch information
m-kuhn committed Sep 13, 2018
2 parents d3ee0f9 + 2182e2d commit 9e40a78a558d31ce0d2b0287f6c0a5e1e6012717
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/gui/qgsmaptooladvanceddigitizing.cpp
@@ -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() );
}
@@ -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() );

0 comments on commit 9e40a78

Please sign in to comment.
You can’t perform that action at this time.