summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authornd101 <Fong@nd.com.cn>2020-03-25 13:43:32 +0800
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-25 17:44:22 +0100
commitdf1be683ab935fe5362750360508ba69eb415afb (patch)
tree5b9f5bb426474e32e39e270a1a705a38453c179b /oox
parentd34f54776f51747658556c148eab0d0fc96ea3e0 (diff)
tdf#131553 a null pointer crashes Impress
When constructing a shape object from property EmbeddedObject, it may return null object. Check the returned value first. Change-Id: I9d7a2d9c0c919007ae2a34a0af86dea5639b1bd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91024 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index eceae6273d06..76b1737e125a 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -942,11 +942,14 @@ Reference< XShape > const & Shape::createAndInsert(
xSet->setPropertyValue("CLSID", uno::makeAny(name.GetHexName()));
uno::Reference<embed::XEmbeddedObject> const xObj(
xSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
- uno::Reference<uno::XInterface> const xMathModel(xObj->getComponent());
- oox::FormulaImportBase *const pMagic(
- dynamic_cast<oox::FormulaImportBase*>(xMathModel.get()));
- assert(pMagic);
- pMagic->readFormulaOoxml(*pMathXml);
+ if (xObj.is())
+ {
+ uno::Reference<uno::XInterface> const xMathModel(xObj->getComponent());
+ oox::FormulaImportBase *const pMagic(
+ dynamic_cast<oox::FormulaImportBase*>(xMathModel.get()));
+ assert(pMagic);
+ pMagic->readFormulaOoxml(*pMathXml);
+ }
}
const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();