[QGIS Commit] r12515 - trunk/qgis/src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Dec 19 07:17:29 EST 2009


Author: wonder
Date: 2009-12-19 07:17:28 -0500 (Sat, 19 Dec 2009)
New Revision: 12515

Modified:
   trunk/qgis/src/gui/qgsmapcanvassnapper.cpp
Log:
Fixed snapping to background layers if there's a layer that doesn't exist. Fixes #2261


Modified: trunk/qgis/src/gui/qgsmapcanvassnapper.cpp
===================================================================
--- trunk/qgis/src/gui/qgsmapcanvassnapper.cpp	2009-12-19 11:10:11 UTC (rev 12514)
+++ trunk/qgis/src/gui/qgsmapcanvassnapper.cpp	2009-12-19 12:17:28 UTC (rev 12515)
@@ -185,15 +185,14 @@
 
         //layer
         layer = QgsMapLayerRegistry::instance()->mapLayer( *layerIt );
-        if ( layer )
-        {
-          vlayer = qobject_cast<QgsVectorLayer *>( layer );
-          if ( vlayer )
-          {
-            snapLayer.mLayer = vlayer;
-          }
-        }
+        if ( layer == NULL )
+          continue;
+        vlayer = qobject_cast<QgsVectorLayer *>( layer );
+        if ( vlayer == NULL )
+          continue;
 
+        snapLayer.mLayer = vlayer;
+
         //tolerance
         snapLayer.mTolerance = tolIt->toDouble();
         snapLayer.mUnitType = ( QgsTolerance::UnitType ) tolUnitIt->toInt();



More information about the QGIS-commit mailing list