tdf#167648 sw letter spacing: fix division by zero

/sw/source/core/text/portxt.cxx:351:90: runtime error: division by zero
    #0 0x7f7bf4700824 in SwTextPortion::SetSpacing(SwTextFormatInfo&, o3tl::strong_int<int, Tag_TextFrameIndex>, int, short) /sw/source/core/text/portxt.cxx:351:90

(<https://ci.libreoffice.org//job/lo_ubsan/3669/>)

Regression from commit 3c53797210
"tdf#167648 sw letter spacing: implement minimum letter spacing".

Change-Id: I1dbea7ce855c1f4cb0604e6f9b96b875dd8eb646
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190608
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins
This commit is contained in:
László Németh
2025-09-05 22:22:32 +02:00
parent 6d0e5ddede
commit 9d8a54d4b6
+4
View File
@@ -344,6 +344,10 @@ sal_uInt16 SwTextPortion::GetMaxComp(const SwTextFormatInfo& rInf) const
void SwTextPortion::SetSpacing( SwTextFormatInfo &rInf, const TextFrameIndex nBreakPos,
const sal_Int32 nSpaces, const sal_Int16 nWidthOf10Spaces )
{
// TODO allow letter spacing and glyph scaling in single word lines, too
if ( nSpaces == 0 )
return;
SvxAdjustItem aAdjustItem =
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust();
// width of a single expanded space without letter spacing and glyph scaling