From dbfa728a078e376ae6d91e27c9ba4276cf6b8082 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 16 Sep 2007 11:04:26 +0000 Subject: [PATCH] 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 --- src/univ/textctrl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); } -- 2.50.0