diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index d398cc1c5a..3883a51c07 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3110,9 +3110,12 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column ) int x, y; m_owner->GetScrollPixelsPerUnit( &x, &y ); - int sy = GetLineStart( rows )/y; + + // Take care to not divide by 0 if we're somehow called before scrolling + // parameters are initialized. + int sy = y ? GetLineStart( rows )/y : -1; int sx = -1; - if( column != -1 ) + if( column != -1 && x ) { wxRect rect = GetClientRect(); int colnum = 0;