sw/source/core/text/portxt.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f6f1c7eb64a5b4ee44278e77e59305878979cfaa
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Mar 5 16:58:06 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Mar 5 15:16:38 2025 +0100

    tdf#165582: nMaxWidth may be negative
    
    Change-Id: Ibe4a57e8a098b219e2662d3ce8645d5caef98123
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182536
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 6a55813ea08a..72c6012db76d 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -227,11 +227,12 @@ static void GetLimitedStringPart(const SwTextFormatInfo& 
rInf, TextFrameIndex nI
                                  TextFrameIndex nLength, sal_uInt16 nComp, 
SwTwips nOriginalWidth,
                                  SwTwips nMaxWidth, TextFrameIndex& 
rOutLength, SwTwips& rOutWidth)
 {
-    assert(nMaxWidth >= 0);
     assert(nLength >= TextFrameIndex(0));
     const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
     rOutLength = nLength;
     rOutWidth = nOriginalWidth;
+    if (nMaxWidth < 0)
+        nMaxWidth = 0;
     while (rOutWidth > nMaxWidth)
     {
         TextFrameIndex nNewOnLineLengthGuess(rOutLength.get() * nMaxWidth / 
rOutWidth);

Reply via email to