Skip to content

Commit

Permalink
Fix for ticket #1149. At times the current row can be returned as -1 …
Browse files Browse the repository at this point in the history
…which will cause a crash if you try to fetch its display role.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8754 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 11, 2008
1 parent 93a0708 commit 154bb2f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/qgsattributetable.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 154bb2f

Please sign in to comment.