[QGIS Commit] r15588 - in trunk/qgis/src/app: . legend

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Mar 23 19:33:23 EDT 2011


Author: wonder
Date: 2011-03-23 16:33:23 -0700 (Wed, 23 Mar 2011)
New Revision: 15588

Modified:
   trunk/qgis/src/app/legend/qgslegend.cpp
   trunk/qgis/src/app/qgisapp.cpp
Log:
Fixed a crash (clicking zoom to layer with no active layer)


Modified: trunk/qgis/src/app/legend/qgslegend.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.cpp	2011-03-23 21:18:59 UTC (rev 15587)
+++ trunk/qgis/src/app/legend/qgslegend.cpp	2011-03-23 23:33:23 UTC (rev 15588)
@@ -1719,6 +1719,9 @@
 
   QgsLegendItem* li = dynamic_cast<QgsLegendItem *>( currentItem() );
 
+  if ( !li )
+    return;
+
   if ( li->type() == QgsLegendItem::LEGEND_LAYER )
   {
     QgsLegendLayer* currentLayer = dynamic_cast<QgsLegendLayer *>( currentItem() );

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2011-03-23 21:18:59 UTC (rev 15587)
+++ trunk/qgis/src/app/qgisapp.cpp	2011-03-23 23:33:23 UTC (rev 15588)
@@ -5790,11 +5790,13 @@
     mActionLocalHistogramStretch->setEnabled( false );
     mActionFullHistogramStretch->setEnabled( false );
     mActionZoomActualSize->setEnabled( false );
+    mActionZoomToLayer->setEnabled( false );
     return;
   }
 
   mActionLayerProperties->setEnabled( true );
   mActionAddToOverview->setEnabled( true );
+  mActionZoomToLayer->setEnabled( true );
 
   /***********Vector layers****************/
   if ( layer->type() == QgsMapLayer::VectorLayer )



More information about the QGIS-commit mailing list