summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-31 11:26:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-10-31 15:31:01 +0100
commitfa83e00dd7bc04d67e025509599a1038702b4ab7 (patch)
tree65ec6a6ed05b9439b3451731a275de6eda2f66b2
parent52a2a6c390b4491eed0a2d29424792fd802cf280 (diff)
Resolves: rhbz#1766990 starmath might not be available
Change-Id: If2e02d8da85a2af576d9563c455487ac3463c935 Reviewed-on: https://gerrit.libreoffice.org/81837 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx33
1 files changed, 19 insertions, 14 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a2d0d1635e7c..5a9d71d1b9e5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2857,20 +2857,25 @@ RTFError RTFDocumentImpl::popState()
OUString aName;
uno::Reference<embed::XEmbeddedObject> xObject
= aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName);
- uno::Reference<util::XCloseable> xComponent(xObject->getComponent(),
- uno::UNO_SET_THROW);
- // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
- // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
- // to RTLD_GLOBAL, so most probably a gcc bug.
- auto& rImport
- = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*xComponent));
- rImport.readFormulaOoxml(m_aMathBuffer);
- auto pValue = new RTFValue(xObject);
- RTFSprms aMathAttributes;
- aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
- writerfilter::Reference<Properties>::Pointer_t pProperties
- = new RTFReferenceProperties(aMathAttributes);
- Mapper().props(pProperties);
+ if (xObject) // rhbz#1766990 starmath might not be available
+ {
+ uno::Reference<util::XCloseable> xComponent(xObject->getComponent(),
+ uno::UNO_SET_THROW);
+ // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
+ // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
+ // to RTLD_GLOBAL, so most probably a gcc bug.
+ auto& rImport = dynamic_cast<oox::FormulaImportBase&>(
+ dynamic_cast<SfxBaseModel&>(*xComponent));
+ rImport.readFormulaOoxml(m_aMathBuffer);
+
+ auto pValue = new RTFValue(xObject);
+ RTFSprms aMathAttributes;
+ aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
+ writerfilter::Reference<Properties>::Pointer_t pProperties
+ = new RTFReferenceProperties(aMathAttributes);
+ Mapper().props(pProperties);
+ }
+
m_aMathBuffer = oox::formulaimport::XmlStreamBuilder();
}
break;