From e8c1abfd7678eb2bfb6c411334f389ada515e14f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 25 Apr 2023 14:08:32 +0300 Subject: tdf#155011: Fix assert/check pFrameStartAfter may be a section frame itself, thus its FindSctFrame would not return this. Same for pSav. Change-Id: Ib592965b30eb47f37ba54fe7f39af0b8689b3175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150981 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 9ca317ff313958706c63b132113d3f706813587d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151013 Reviewed-by: Xisco Fauli (cherry picked from commit 4f5a196b4aaaaa86ccc5250f25d298e13a0fa952) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151112 Tested-by: Aron Budea Reviewed-by: Aron Budea Reviewed-by: Miklos Vajna --- sw/qa/extras/htmlimport/data/tdf155011.html | 31 +++++++++++++++++++++++++++++ sw/qa/extras/htmlimport/htmlimport.cxx | 6 ++++++ sw/source/core/layout/sectfrm.cxx | 4 ++-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 sw/qa/extras/htmlimport/data/tdf155011.html diff --git a/sw/qa/extras/htmlimport/data/tdf155011.html b/sw/qa/extras/htmlimport/data/tdf155011.html new file mode 100644 index 000000000000..b3bc7845b56a --- /dev/null +++ b/sw/qa/extras/htmlimport/data/tdf155011.html @@ -0,0 +1,31 @@ + + + + + + +
+
+ + + + +
+
+
+ + + + +
+ +
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx index c97d4e4cbde4..7b7f3a0269e3 100644 --- a/sw/qa/extras/htmlimport/htmlimport.cxx +++ b/sw/qa/extras/htmlimport/htmlimport.cxx @@ -574,6 +574,12 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testRGBAColor) CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty(xRun, "CharBackColor")); } +CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf155011) +{ + createSwWebDoc("tdf155011.html"); + // Must not crash / fail asserts +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index cc6c3982d3a4..0b1ac612bfd9 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -522,9 +522,9 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt ) |*/ SwSectionFrame* SwSectionFrame::SplitSect( SwFrame* pFrameStartAfter, SwFrame* pFramePutAfter ) { - assert(!pFrameStartAfter || pFrameStartAfter->FindSctFrame() == this); + assert(!pFrameStartAfter || IsAnLower(pFrameStartAfter)); SwFrame* pSav = pFrameStartAfter ? pFrameStartAfter->FindNext() : ContainsAny(); - if (pSav && pSav->FindSctFrame() != this) + if (pSav && !IsAnLower(pSav)) pSav = nullptr; // we are at the very end // Put the content aside -- cgit