[QGIS Commit] r13817 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jun 27 12:39:17 EDT 2010


Author: jef
Date: 2010-06-27 16:39:17 +0000 (Sun, 27 Jun 2010)
New Revision: 13817

Modified:
   trunk/qgis/src/app/qgisapp.cpp
Log:
fix crash on layerless OGR data sources

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-06-27 12:07:52 UTC (rev 13816)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-06-27 16:39:17 UTC (rev 13817)
@@ -2627,7 +2627,7 @@
         delete layer;
 
       }
-      else  // there is 1 layer of data available
+      else if ( sublayers.count() > 0 ) // there is 1 layer of data available
       {
         //set friendly name for datasources with only one layer
         QStringList sublayers = layer->dataProvider()->subLayers();
@@ -2637,6 +2637,12 @@
         // Register this layer with the layers registry
         QgsMapLayerRegistry::instance()->addMapLayer( layer );
       }
+      else
+      {
+        QString msg = tr( "%1 doesn't have any layers" ).arg( src );
+        QMessageBox::critical( this, tr( "Invalid Data Source" ), msg );
+        delete layer;
+      }
     }
     else
     {



More information about the QGIS-commit mailing list