don't crash when auto sizing empty grid
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9290,11 +9290,12 @@ void wxGrid::AutoSize()
|
||||
wxSize sizeFit(GetScrollX(size.x + m_extraWidth + 1) * GRID_SCROLL_LINE_X,
|
||||
GetScrollY(size.y + m_extraHeight + 1) * GRID_SCROLL_LINE_Y);
|
||||
|
||||
// distribute the extra space between teh columns/rows to avoid having
|
||||
// distribute the extra space between the columns/rows to avoid having
|
||||
// extra white space
|
||||
|
||||
// Remove the extra m_extraWidth + 1 added above
|
||||
wxCoord diff = sizeFit.x - size.x + (m_extraWidth + 1);
|
||||
if ( diff )
|
||||
if ( diff && m_numCols )
|
||||
{
|
||||
// try to resize the columns uniformly
|
||||
wxCoord diffPerCol = diff / m_numCols;
|
||||
@@ -9319,7 +9320,7 @@ void wxGrid::AutoSize()
|
||||
|
||||
// same for rows
|
||||
diff = sizeFit.y - size.y - (m_extraHeight + 1);
|
||||
if ( diff )
|
||||
if ( diff && m_numRows )
|
||||
{
|
||||
// try to resize the columns uniformly
|
||||
wxCoord diffPerRow = diff / m_numRows;
|
||||
|
Reference in New Issue
Block a user