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 /xmloff | |
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 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLSeries2Context.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 27 |
3 files changed, 14 insertions, 27 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 848416b8a2fe..5b9dea65ff5f 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -447,8 +447,7 @@ bool lcl_isSeriesAttachedToFirstAxis( { sal_Int32 nAxisIndex = 0; Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW ); - if( xProp.is() ) - xProp->getPropertyValue("AttachedAxisIndex") >>= nAxisIndex; + xProp->getPropertyValue("AttachedAxisIndex") >>= nAxisIndex; bResult = (0==nAxisIndex); } catch( const uno::Exception & ) diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index b646a2e891f5..332597235dcb 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -909,14 +909,11 @@ void SchXMLSeries2Context::setStylesToRegressionCurves( Reference< chart2::XRegressionCurve > xRegCurve( xMSF->createInstance( aServiceName ), uno::UNO_QUERY_THROW ); Reference< chart2::XRegressionCurveContainer > xRegCurveCont( regressionStyle.m_xSeries, uno::UNO_QUERY_THROW ); - if( xRegCurve.is()) - { - Reference< beans::XPropertySet > xCurveProperties( xRegCurve, uno::UNO_QUERY ); - if( pPropStyleContext != nullptr) - pPropStyleContext->FillPropertySet( xCurveProperties ); + Reference< beans::XPropertySet > xCurveProperties( xRegCurve, uno::UNO_QUERY ); + if( pPropStyleContext != nullptr) + pPropStyleContext->FillPropertySet( xCurveProperties ); - xRegCurve->setEquationProperties( regressionStyle.m_xEquationProperties ); - } + xRegCurve->setEquationProperties( regressionStyle.m_xEquationProperties ); xRegCurveCont->addRegressionCurve( xRegCurve ); } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 3d74d57f0853..5d2bad9e303b 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3331,23 +3331,17 @@ void SdXMLFrameShapeContext::removeGraphicFromImportContext(const SvXMLImportCon { uno::Reference< container::XChild > xChild(pSdXMLGraphicObjectShapeContext->getShape(), uno::UNO_QUERY_THROW); - if(xChild.is()) - { - uno::Reference< drawing::XShapes > xParent(xChild->getParent(), uno::UNO_QUERY_THROW); + uno::Reference< drawing::XShapes > xParent(xChild->getParent(), uno::UNO_QUERY_THROW); - if(xParent.is()) - { - // remove from parent - xParent->remove(pSdXMLGraphicObjectShapeContext->getShape()); + // remove from parent + xParent->remove(pSdXMLGraphicObjectShapeContext->getShape()); - // dispose - uno::Reference< lang::XComponent > xComp(pSdXMLGraphicObjectShapeContext->getShape(), UNO_QUERY); + // dispose + uno::Reference< lang::XComponent > xComp(pSdXMLGraphicObjectShapeContext->getShape(), UNO_QUERY); - if(xComp.is()) - { - xComp->dispose(); - } - } + if(xComp.is()) + { + xComp->dispose(); } } catch( uno::Exception& ) @@ -3403,10 +3397,7 @@ OUString SdXMLFrameShapeContext::getGraphicPackageURLFromImportContext(const SvX { const uno::Reference< beans::XPropertySet > xPropSet(pSdXMLGraphicObjectShapeContext->getShape(), uno::UNO_QUERY_THROW); - if (xPropSet.is()) - { - xPropSet->getPropertyValue("GraphicStreamURL") >>= aRetval; - } + xPropSet->getPropertyValue("GraphicStreamURL") >>= aRetval; } catch( uno::Exception& ) { |