Add some sanity checking to SelectRow to prevent an invalid row from being selected when undoing line insertions

Originally committed to SVN as r3006.
This commit is contained in:
harukalover 2009-06-03 19:04:54 +00:00
parent ec297a5f11
commit 5c89ff4a50

View file

@ -170,6 +170,10 @@ void BaseGrid::MakeCellVisible(int row, int col,bool center) {
//////////////// ////////////////
// Select a row // Select a row
void BaseGrid::SelectRow(int row, bool addToSelected, bool select) { void BaseGrid::SelectRow(int row, bool addToSelected, bool select) {
// Sanity checking
if (row >= GetRows()) row = GetRows()-1;
else if (row < 0) row = 0;
if (!addToSelected) ClearSelection(); if (!addToSelected) ClearSelection();
try { try {
bool cur = selMap.at(row); bool cur = selMap.at(row);