Fix crash when scrolling wxGrid in which scrolling is disabled

If "pixels per line" is set to 0, indicating that scrolling is disabled,
just don't scroll in the corresponding direction instead of dividing by
zero.

Closes https://github.com/wxWidgets/wxWidgets/pull/2323
This commit is contained in:
Vadim Zeitlin
2021-04-27 13:58:49 +02:00
parent 84bcc109ad
commit 1671a21e7c

View File

@@ -8099,8 +8099,9 @@ void wxGrid::MakeCellVisible( int row, int col )
col < -1 || col >= m_numCols )
return;
const bool processRow = row != -1;
const bool processCol = col != -1;
// We don't scroll in the corresponding direction if "pixels per line" is 0.
const bool processRow = row != -1 && m_yScrollPixelsPerLine != 0;
const bool processCol = col != -1 && m_xScrollPixelsPerLine != 0;
// Get the cell rectangle in logical coords.
wxRect r;