svx/source/dialog/svxruler.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 93b042f488db7d036821efdb967747a1f9c838e0
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jan 13 10:56:55 2023 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jan 14 17:26:33 2023 +0000

    svx: avoid divide by zero in SvxRuler::UpdateTabs()
    
    Prevent lDefTabDist from ending up in a zero state.
    
    See 
https://crashreport.libreoffice.org/stats/signature/SvxRuler::UpdateTabs()
    
    Change-Id: I9335f3be12de5db4f4f0c3f434057d91f96733ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145457
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 4d873c23773e..be53a0c91c58 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -969,6 +969,9 @@ void SvxRuler::SetDefTabDist(tools::Long inDefTabDist)  // 
New distance for Defa
         UpdateFrame(); // hack: try to get lAppNullOffset initialized
     /* New distance is set for DefaultTabs */
     lDefTabDist = inDefTabDist;
+    if( !lDefTabDist )
+        lDefTabDist = 1;
+
     UpdateTabs();
 }
 
@@ -1026,9 +1029,6 @@ void SvxRuler::UpdateTabs()
 
         tools::Long nDefTabDist = ConvertHPosPixel(lDefTabDist);
 
-        if( !nDefTabDist )
-            nDefTabDist = 1;
-
         const sal_uInt16 nDefTabBuf = lPosPixel > lRightIndent || lLastTab > 
lRightIndent
                     ? 0
                     : static_cast<sal_uInt16>( (lRightIndent - lPosPixel) / 
nDefTabDist );

Reply via email to