Kaydet (Commit) a18bb779 authored tarafından Mark Hung's avatar Mark Hung

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 e559d360 ( related to tdf#90243 ).

Change-Id: I05fc45c631f8acd3b9ba8c8305d4bc1e31651824
Reviewed-on: https://gerrit.libreoffice.org/67901
Tested-by: Jenkins
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst 16bd9c99
......@@ -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)
......
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