sw/qa/extras/ooxmlexport/data/tdf124795-5.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx     |    6 ++++++
 sw/source/core/text/portxt.cxx                 |    1 +
 3 files changed, 7 insertions(+)

New commits:
commit 9e201cbdc31caca694e067ee0f66cce2b07c9778
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Fri Jan 5 01:11:34 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Jan 5 15:49:09 2024 +0100

    tdf#159032 sw smart justify: fix crash with complex tables
    
    Regression from commit 36bfc86e27fa03ee16f87819549ab126c5a68cac
    "tdf#119908 tdf#158776 sw smart justify: shrink only spaces"
    
    Change-Id: Ia3f39ad6549ea909bfe327ff8c8cbde821b90f46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161652
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 99f022bdeb2817cceffc90ff3b3439cdc4550424)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161638
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx
new file mode 100644
index 000000000000..19fd5f49c89c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124795-5.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 0656bb868795..4b0fbdd13716 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1414,6 +1414,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158436, "tdf158436.docx")
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf159032, "tdf124795-5.docx")
+{
+    // This resulted crashing
+    CPPUNIT_ASSERT_EQUAL(57, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHyphenationAuto)
 {
     loadAndReload("hyphenation.odt");
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index bcc547d1796b..3dcdf37ecc90 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -308,6 +308,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
     // adjusted line by shrinking spaces using the know space count from the 
first Guess() call
     const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
     if ( bFull && rAdjust == SvxAdjust::Block &&
+         aGuess.BreakPos() != TextFrameIndex(COMPLETE_STRING) &&
          rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
                     DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
          // tdf#158436 avoid shrinking at underflow, e.g. no-break space after 
a

Reply via email to