Skip to content

Commit 06cbd6d

Browse files
author
wonder
committed
Fixed snapping to background layers if there's a layer that doesn't exist. Fixes #2261
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12515 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6a314a5 commit 06cbd6d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/gui/qgsmapcanvassnapper.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,13 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QPoint& p, QList<QgsSnapp
185185

186186
//layer
187187
layer = QgsMapLayerRegistry::instance()->mapLayer( *layerIt );
188-
if ( layer )
189-
{
190-
vlayer = qobject_cast<QgsVectorLayer *>( layer );
191-
if ( vlayer )
192-
{
193-
snapLayer.mLayer = vlayer;
194-
}
195-
}
188+
if ( layer == NULL )
189+
continue;
190+
vlayer = qobject_cast<QgsVectorLayer *>( layer );
191+
if ( vlayer == NULL )
192+
continue;
193+
194+
snapLayer.mLayer = vlayer;
196195

197196
//tolerance
198197
snapLayer.mTolerance = tolIt->toDouble();

0 commit comments

Comments
 (0)