diff options
author | Mark Hung <marklh9@gmail.com> | 2019-02-16 21:14:43 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2019-02-18 12:39:54 +0100 |
commit | a18bb779e03217db6e18ba6b8110289b4b3f101d (patch) | |
tree | 7614e39b0fb2883c29119465be677df8c93aa350 /sd | |
parent | 16bd9c99b8116f36e4f0825860e699d79cdf0d58 (diff) |
sd: fix crashing when adding new effects to media.
Check if the objct has name roperty with hasPropertyByName() before
accessing in case some objects ( media, table, control, etc. ) do not
have name property.
Regression caused by e559d360d0a19 ( related to tdf#90243 ).
Change-Id: I05fc45c631f8acd3b9ba8c8305d4bc1e31651824
Reviewed-on: https://gerrit.libreoffice.org/67901
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 659d622a3ffe..7e3107b80baa 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -129,16 +129,25 @@ OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText Reference< XPropertySet > xSet( xShape, UNO_QUERY ); bool bAppendIndex = true; - if( xSet.is() ) + if(xSet.is()) try { Reference<XPropertySetInfo> xInfo(xSet->getPropertySetInfo()); + if (xInfo.is()) + { + const OUString aPropName1("Name"); + if(xInfo->hasPropertyByName(aPropName1)) + xSet->getPropertyValue(aPropName1) >>= aDescription; - xSet->getPropertyValue("Name") >>= aDescription; - bAppendIndex = aDescription.isEmpty(); + bAppendIndex = aDescription.isEmpty(); - const OUString aPropName("UINameSingular"); - if(xInfo->hasPropertyByName(aPropName)) - xSet->getPropertyValue(aPropName) >>= aDescription; + const OUString aPropName2("UINameSingular"); + if(xInfo->hasPropertyByName(aPropName2)) + xSet->getPropertyValue(aPropName2) >>= aDescription; + } + } + catch( Exception& ) + { + OSL_FAIL("sd::getShapeDescription(), exception caught!" ); } if (bAppendIndex) |