Skip to content
Permalink
Browse files
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.

git-svn-id: http://svn.osgeo.org/qgis/trunk@8754 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 11, 2008
1 parent 6972f69 commit 30c9aa0315d7b61fe054f21b8e7d0106fd24ee34
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/app/qgsattributetable.cpp
@@ -358,8 +358,15 @@ void QgsAttributeTable::contextMenuEvent(QContextMenuEvent *event)
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;

0 comments on commit 30c9aa0

Please sign in to comment.