diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4bd5a22d97..ef02bf6b4e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9615,7 +9615,7 @@ void wxGrid::SetCellHighlightPenWidth(int width) // make any visible change if the the thickness is getting smaller. int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - if ( GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 ) + if ( row == -1 || col == -1 || GetColWidth(col) <= 0 || GetRowHeight(row) <= 0 ) return; wxRect rect = CellToRect(row, col);