Kaydet (Commit) 0de80b40 authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Caolán McNamara

tdf#90046: RTF import: ensure that a run is started before \footnote

Avoids crashing with empty context stacks.

Change-Id: I0ee8b457fdbb19b55f5c15876b7253680cde6e23
(cherry picked from commit a61fd02c)
Reviewed-on: https://gerrit.libreoffice.org/17334Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 1e832328
{\rtf1\ansi\deflang1035
{\fonttbl {\f0\fcharset0 Arial;} }
\pard\ltrpar\uc1\lang1035
{\super \chftn
{\footnote {\pard\plain\super \chftn }{\plain\ltrch\f0 \fs18 \cf1 \uc0\u77 \u97 }
}}
}
......@@ -2173,6 +2173,15 @@ DECLARE_RTFIMPORT_TEST(testFdo85889pca, "fdo85889-pca.rtf")
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
DECLARE_RTFIMPORT_TEST(testTdf90046, "tdf90046.rtf")
{
// this was crashing on importing the footnote
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Ma"), xTextRange->getString());
}
DECLARE_RTFIMPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
......
......@@ -1676,6 +1676,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
}
break;
case RTF_FOOTNOTE:
checkFirstRun();
if (!m_pSuperstream)
{
Id nId = NS_ooxml::LN_footnote;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment