diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 0abf606854..2a1c2e2688 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -8036,6 +8036,9 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft, int cw, ch; m_gridWin->GetClientSize( &cw, &ch ); + if (right < 0 || bottom < 0 || left > cw || top > ch) + return wxRect( 0, 0, 0, 0); + rect.SetLeft( wxMax(0, left) ); rect.SetTop( wxMax(0, top) ); rect.SetRight( wxMin(cw, right) );