diff options
-rw-r--r-- | sw/qa/uitest/data/tdf146248.docx | bin | 0 -> 11387 bytes | |||
-rw-r--r-- | sw/qa/uitest/writer_tests4/insertPageHeader.py | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/tdf146248.docx b/sw/qa/uitest/data/tdf146248.docx Binary files differnew file mode 100644 index 000000000000..2b5ed2959f94 --- /dev/null +++ b/sw/qa/uitest/data/tdf146248.docx diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py index 6516a31dab4d..406671021881 100644 --- a/sw/qa/uitest/writer_tests4/insertPageHeader.py +++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file class WriterInsertPageHeader(UITestCase): @@ -61,4 +62,17 @@ class WriterInsertPageHeader(UITestCase): self.delete_header() + def test_tdf146248(self): + with self.ui_test.load_file(get_url_for_data_file("tdf146248.docx")): + + self.delete_header() + + # crashed before + self.xUITest.executeCommand(".uno:Undo") + + document = self.ui_test.get_component() + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 538ea72430b0..e5fefbc0e376 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1191,6 +1191,9 @@ lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode const *const pSttNode, if (pHeadFootFormat) { const SwFormatContent& rFlyContent = pHeadFootFormat->GetContent(); + // tdf#146248 avoid Undo crash at shared first page + if ( !rFlyContent.GetContentIdx() ) + return false; const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode(); SwStartNode const*const pCurSttNode = rNode.FindSttNodeByType( bHeader ? SwHeaderStartNode : SwFooterStartNode); |