summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-05-25 11:57:13 +0200
committerLászló Németh <nemeth@numbertext.org>2022-05-26 20:26:13 +0200
commit73696a01224a3758bde686f32ec7e6f4c90877fe (patch)
tree721e88dbe7056afa013e261b80eaa0a1d8a24766 /writerfilter
parent29359fc15c435cec17987fd6221ab6833d38746e (diff)
tdf#146955 DOCX import: fix SAX exception with footnotes
(Likely broken) DOCX documents exported by Writer raised a SAX exception, when PopFootOrEndnote() tried to access to a not-existent footnote, because PushFootOrEndnote() failed to create that. Note: the original ODT contains hundreds of frames, and these and the text content of the document have been put into the TOC section during Writer's DOCX export, resulting a broken document. Regression from commit 9b39ce0e66acfe812e1d50e530dc2ccdef3e1357 "tdf#76260 DOCX import: fix slow footnote import". Change-Id: I9e32feb0cae778a87f034a8b5c41989fec90899d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134934 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1371b7cc0e32..4e769e15b0cf 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3504,13 +3504,11 @@ void DomainMapper_Impl::PopFootOrEndnote()
uno::Reference< text::XFootnote > xFootnoteFirst, xFootnoteLast;
auto xFootnotes = xFootnotesSupplier->getFootnotes();
auto xEndnotes = xEndnotesSupplier->getEndnotes();
- if (IsInFootnote())
- xFootnotes->getByIndex(xFootnotes->getCount()-1) >>= xFootnoteLast;
- else
- xEndnotes->getByIndex(xEndnotes->getCount()-1) >>= xFootnoteLast;
- if ( ( ( IsInFootnote() && xFootnotes->getCount() > 1 ) ||
- ( !IsInFootnote() && xEndnotes->getCount() > 1 ) ) &&
- xFootnoteLast->getLabel().isEmpty() )
+ if ( ( ( IsInFootnote() && xFootnotes->getCount() > 1 &&
+ ( xFootnotes->getByIndex(xFootnotes->getCount()-1) >>= xFootnoteLast ) ) ||
+ ( !IsInFootnote() && xEndnotes->getCount() > 1 &&
+ ( xEndnotes->getByIndex(xEndnotes->getCount()-1) >>= xFootnoteLast ) )
+ ) && xFootnoteLast->getLabel().isEmpty() )
{
// copy content of the first remaining temporary footnote
if ( IsInFootnote() )