diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLFootnoteImportContext.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/text/XMLFootnoteImportContext.hxx | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx index a73147ec09f1..fc9605bd8651 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteImportContext.cxx @@ -19,6 +19,7 @@ #include "XMLFootnoteImportContext.hxx" +#include <comphelper/diagnose_ex.hxx> #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <xmloff/xmlimp.hxx> @@ -102,7 +103,16 @@ void XMLFootnoteImportContext::startFastElement( // save old cursor and install new one xOldCursor = rHelper.GetCursor(); Reference<XText> xText(xTextContent, UNO_QUERY); - rHelper.SetCursor(xText->createTextCursor()); + try + { + // May fail e.g. for a nested footnote, which is formally a valid ODF, but is not supported + rHelper.SetCursor(xText->createTextCursor()); + } + catch (css::uno::RuntimeException&) + { + TOOLS_WARN_EXCEPTION("xmloff.text", "skipping the footnote: caught"); + mbIsValid = false; + } // remember old list item and block (#89891#) and reset them // for the footnote @@ -132,6 +142,8 @@ void XMLFootnoteImportContext::endFastElement(sal_Int32 ) css::uno::Reference< css::xml::sax::XFastContextHandler > XMLFootnoteImportContext::createFastChildContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { + if (!mbIsValid) + return {}; SvXMLImportContextRef xContext; switch(nElement) diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx b/xmloff/source/text/XMLFootnoteImportContext.hxx index d05b7b631c22..8321639bbd1a 100644 --- a/xmloff/source/text/XMLFootnoteImportContext.hxx +++ b/xmloff/source/text/XMLFootnoteImportContext.hxx @@ -42,6 +42,7 @@ class XMLFootnoteImportContext : public SvXMLImportContext /// old list item and block (#89891#) bool mbListContextPushed; + bool mbIsValid = true; /// text import helper; holds current XTextCursor (and XText) XMLTextImportHelper& rHelper; |