cid#1659736 Division or modulo by float zero

For char/line, the other cases gets set to non 0.

In many of the other units we set lower levels equal
to the level above so we don't have a smaller tick size
to attempt to draw, so explicitly do this for char/line.

probably in the code since:

commit dda8877b98
Date:   Mon Sep 2 23:25:33 2013 +0200

    Ruler: minimal unit 1/16 inch, 1/10 cm, dynamic tick draw, various

Change-Id: Ifaa88144ec54922017fd66b0deeaa398b28b700d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195178
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2025-12-07 11:41:51 +01:00
parent 42de271b19
commit bcd994e16a
+4 -8
View File
@@ -427,7 +427,8 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin,
tools::Long DPIOffset = nScale - 1;
double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4;
double nTick2 = 0;
double nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
double nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2;
double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale;
double nTickUnit = 0;
tools::Long nTickWidth;
@@ -440,6 +441,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin,
if (mnCharWidth == 0)
mnCharWidth = 371;
nTick4 = mnCharWidth * 2;
nTick3 = mnCharWidth;
nTick2 = mnCharWidth;
nTickCount = mnCharWidth;
nTickUnit = mnCharWidth;
@@ -449,6 +451,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin,
if (mnLineHeight == 0)
mnLineHeight = 551;
nTick4 = mnLineHeight * 2;
nTick3 = mnLineHeight;
nTick2 = mnLineHeight;
nTickUnit = mnLineHeight;
nTickCount = mnLineHeight;
@@ -531,13 +534,6 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin,
tools::Long n = 0;
double nTick = 0.0;
double nTick3 = 0;
if ((mnUnitIndex != RULER_UNIT_CHAR) && (mnUnitIndex != RULER_UNIT_LINE))
{
nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2;
nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
}
Size nTickGapSize;