tdf#166436: check field stack is not empty

like other places do

Change-Id: I6fcb2bd849b11b0f17f1b19193a24c8e1f4ee660
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184909
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli
2025-05-02 16:54:33 +02:00
parent fbca764f46
commit d72156ff08
3 changed files with 10 additions and 1 deletions

Binary file not shown.

View File

@@ -292,6 +292,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138739, "tdf138739.docx")
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(5), 3), u"CharWeight"_ustr));
}
CPPUNIT_TEST_FIXTURE(Test, testTdf166436)
{
// Without the fix in place, this test would have crashed at import time
loadAndReload("tdf166436.docx");
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
CPPUNIT_ASSERT(xFieldsAccess->hasElements());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf123390)
{
loadAndReload("tdf123390.fodt");

View File

@@ -2741,7 +2741,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
}
}
else if ( pSectionContext )
else if ( pSectionContext && m_pImpl->IsOpenField())
{
FieldContextPtr pContext = m_pImpl->GetTopFieldContext();
rtl::Reference< SwXSection > xTOC = pContext->GetTOC();