[QGIS Commit] r15305 - trunk/qgis/src/providers/spatialite

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Mar 1 07:58:56 EST 2011


Author: mhugent
Date: 2011-03-01 04:58:56 -0800 (Tue, 01 Mar 2011)
New Revision: 15305

Modified:
   trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp
Log:
Fix crash in ticket #3528

Modified: trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp
===================================================================
--- trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp	2011-03-01 09:14:12 UTC (rev 15304)
+++ trunk/qgis/src/providers/spatialite/qgsspatialiteprovider.cpp	2011-03-01 12:58:56 UTC (rev 15305)
@@ -908,7 +908,12 @@
   uniqueValues.clear();
 
   // get the field name
-  const QgsField & fld = field( index );
+  QgsFieldMap::const_iterator fieldIt = attributeFields.find( index );
+  if ( fieldIt == attributeFields.constEnd() )
+  {
+    return; //invalid field
+  }
+  const QgsField& fld = fieldIt.value();
 
   sql = QString( "SELECT DISTINCT %1 FROM %2 ORDER BY %1" ).arg( quotedIdentifier( fld.name() ) ).arg( mQuery );
 



More information about the QGIS-commit mailing list