diff --git a/src/gui/qgsadvanceddigitizingdockwidget.cpp b/src/gui/qgsadvanceddigitizingdockwidget.cpp index c14c551d2ab..014a87cb63f 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.cpp +++ b/src/gui/qgsadvanceddigitizingdockwidget.cpp @@ -914,14 +914,19 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e ) * a Z value. * To get the value we use the snapPoint method. However, we only apply it * when the snapped point corresponds to the constrained point or on an edge - * if the topological editing is activated. + * if the topological editing is activated. Also, we don't apply it if + * the point is not linked to a layer. */ e->setMapPoint( point ); mSnapMatch = context.snappingUtils->snapToMap( point, nullptr, true ); - if ( ( ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) && ( point == mSnapMatch.point() ) ) || ( mSnapMatch.hasEdge() && QgsProject::instance()->topologicalEditing() ) ) + if ( mSnapMatch.layer() ) { - e->snapPoint(); - point = mSnapMatch.interpolatedPoint( mMapCanvas->mapSettings().destinationCrs() ); + if ( ( ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) && ( point == mSnapMatch.point() ) ) + || ( mSnapMatch.hasEdge() && QgsProject::instance()->topologicalEditing() ) ) + { + e->snapPoint(); + point = mSnapMatch.interpolatedPoint( mMapCanvas->mapSettings().destinationCrs() ); + } } /*