diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-07 13:03:58 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-06-08 01:29:32 +0200 |
commit | 5708534b942c1d0ce384f6a8473da6bb569410e7 (patch) | |
tree | 2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /sd/source/ui/unoidl/unopage.cxx | |
parent | 1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff) |
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned
to the value.
Idea from tml.
Used the following script to find places:
git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()'
Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969
Reviewed-on: https://gerrit.libreoffice.org/55417
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source/ui/unoidl/unopage.cxx')
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index b612cc66ce46..8749fa94d287 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2809,29 +2809,26 @@ void SdMasterPage::setBackground( const Any& rValue ) { Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW ); Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ; - if( xFamily.is() ) - { - OUString aStyleName(sUNO_PseudoSheet_Background); + OUString aStyleName(sUNO_PseudoSheet_Background); - Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW ); + Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW ); - Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW ); - Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); + Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW ); + Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); - PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries(); - PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin(); - while( aIt != aBackgroundProperties.end() ) + PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries(); + PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin(); + while( aIt != aBackgroundProperties.end() ) + { + if( xSetInfo->hasPropertyByName( aIt->sName ) ) { - if( xSetInfo->hasPropertyByName( aIt->sName ) ) - { - if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE ) - xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) ); - else - xSetStates->setPropertyToDefault( aIt->sName ); - } - - ++aIt; + if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE ) + xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) ); + else + xSetStates->setPropertyToDefault( aIt->sName ); } + + ++aIt; } } else |