mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
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:
parent
6972f69e68
commit
30c9aa0315
@ -358,8 +358,15 @@ void QgsAttributeTable::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
mActionValues.clear();
|
mActionValues.clear();
|
||||||
|
|
||||||
for (int i = 0; i < columnCount(); ++i)
|
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
|
// The item that was clicked on, stored as an index into the
|
||||||
// mActionValues vector.
|
// mActionValues vector.
|
||||||
mClickedOnValue = col;
|
mClickedOnValue = col;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user