fix divide by 0 bug in UpdateScrollbars() (part of patch 1716763)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48721 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-09-16 11:04:26 +00:00
parent 1fc5dc69fd
commit dbfa728a07

View File

@@ -3615,8 +3615,12 @@ void wxTextCtrl::UpdateScrollbars()
if ( scrollRangeXOld ) if ( scrollRangeXOld )
{ {
x *= scrollRangeX - m_rectText.width / charWidth; const int w = m_rectText.width / charWidth;
x /= scrollRangeXOld - m_rectText.width / charWidth; if ( w != scrollRangeXOld )
{
x *= scrollRangeX - w;
x /= scrollRangeXOld - w;
}
Scroll(x, y); Scroll(x, y);
} }