sw/source/core/txtnode/fntcache.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a52b1610009096c171b7571b9c2e8c307cada90b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Apr 4 13:15:05 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Apr 4 15:54:57 2022 +0200

    Resolves: tdf#148336 portion width can be zero
    
    Change-Id: I9dcbf024882a0ca055d1847345ab2b8084d5871d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132510
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index e1c33c85cf2f..e4009930bfbb 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2001,11 +2001,12 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
     else
         rInf.SetKanaDiff( 0 );
 
-    aTextSize.setWidth(aKernArray[sal_Int32(nLn) - 1]);
-
-
-    if ( rInf.GetKern() && nLn )
-        aTextSize.AdjustWidth((sal_Int32(nLn) - 1) * rInf.GetKern());
+    if (nLn)
+    {
+        aTextSize.setWidth(aKernArray[sal_Int32(nLn) - 1]);
+        if (rInf.GetKern())
+            aTextSize.AdjustWidth((sal_Int32(nLn) - 1) * rInf.GetKern());
+    }
 
     OSL_ENSURE( !rInf.GetShell() ||
             ( USHRT_MAX != GetGuessedLeading() && USHRT_MAX != 
GetExternalLeading() ),

Reply via email to