From: Vadim Zeitlin Date: Sun, 16 Sep 2007 11:04:26 +0000 (+0000) Subject: fix divide by 0 bug in UpdateScrollbars() (part of patch 1716763) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/dbfa728a078e376ae6d91e27c9ba4276cf6b8082?ds=inline 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 --- diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index d8816f8974..00e987b800 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -3615,8 +3615,12 @@ void wxTextCtrl::UpdateScrollbars() if ( scrollRangeXOld ) { - x *= scrollRangeX - m_rectText.width / charWidth; - x /= scrollRangeXOld - m_rectText.width / charWidth; + const int w = m_rectText.width / charWidth; + if ( w != scrollRangeXOld ) + { + x *= scrollRangeX - w; + x /= scrollRangeXOld - w; + } Scroll(x, y); }