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
This commit is contained in:
timlinux 2008-07-11 17:54:28 +00:00
parent 6972f69e68
commit 30c9aa0315

View File

@ -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;