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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Jul 11 13:54:28 EDT 2008


Author: timlinux
Date: 2008-07-11 13:54:28 -0400 (Fri, 11 Jul 2008)
New Revision: 8754

Modified:
   trunk/qgis/src/app/qgsattributetable.cpp
Log:
Fix for ticket #1149. At times the current row can be returned as -1 which will cause a crash if you try to fetch its display role.

Modified: trunk/qgis/src/app/qgsattributetable.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetable.cpp	2008-07-11 16:14:33 UTC (rev 8753)
+++ trunk/qgis/src/app/qgsattributetable.cpp	2008-07-11 17:54:28 UTC (rev 8754)
@@ -358,8 +358,15 @@
   mActionValues.clear();
 
   for (int i = 0; i < columnCount(); ++i)
-    mActionValues.push_back(std::make_pair(horizontalHeaderItem(i)->text(), item(row, i)->text()));
-
+  {
+    if (row >= 0) //prevent crash if row is negative, see ticket #1149
+    {
+      mActionValues.push_back(
+        std::make_pair(
+          horizontalHeaderItem( i )->text(),
+          item( row, i )->text() ) );
+    }
+  }
   // The item that was clicked on, stored as an index into the
   // mActionValues vector.
   mClickedOnValue = col;



More information about the QGIS-commit mailing list