summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-01-13 10:56:55 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-01-25 08:49:47 +0000
commit8c19251c88c12dfd65c4e320e9ee41a20c8866ff (patch)
tree1c43c4fb934e9a62f10ea4bea7679c3f6b8b792f
parenttdf#152622 Fix color of Object Boundaries in dark mode (diff)
downloadcore-8c19251c88c12dfd65c4e320e9ee41a20c8866ff.tar.gz
core-8c19251c88c12dfd65c4e320e9ee41a20c8866ff.zip
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.grandin@collabora.co.uk> (cherry picked from commit 93b042f488db7d036821efdb967747a1f9c838e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145450 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> (cherry picked from commit 586d2790b775428ab0d3eeb681e0c78888a4f5b5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145582 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Patrick Luby <plubius@neooffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--svx/source/dialog/svxruler.cxx6
1 files changed, 3 insertions, 3 deletions
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 );