Fix recently introduced crash during wxGrid initialization
CellToGridWindow(), added by frozen rows/columns patch, returned NULL when called with invalid row/col arguments and this could happen if any of several methods using m_currentCellCoords were called during wxGrid initialization, while m_currentCellCoords was still (-1, -1). Fix this by testing for this case explicitly and returning the main grid window, which is never NULL, instead. Closes #18454.
This commit is contained in:
committed by
Vadim Zeitlin
parent
bcf604b5cb
commit
b9d668e8f1
@@ -7323,7 +7323,12 @@ wxRect wxGrid::CellToRect( int row, int col ) const
|
||||
|
||||
wxGridWindow* wxGrid::CellToGridWindow( int row, int col ) const
|
||||
{
|
||||
if ( row < m_numFrozenRows && GetColPos(col) < m_numFrozenCols )
|
||||
// It may happen that we're called during grid creation, when the current
|
||||
// cell still has invalid coordinates -- don't return (possibly null)
|
||||
// frozen corner window in this case.
|
||||
if ( row == -1 && col == -1 )
|
||||
return m_gridWin;
|
||||
else if ( row < m_numFrozenRows && GetColPos(col) < m_numFrozenCols )
|
||||
return m_frozenCornerGridWin;
|
||||
else if ( row < m_numFrozenRows )
|
||||
return m_frozenRowGridWin;
|
||||
|
Reference in New Issue
Block a user