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 /sfx2/source | |
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 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/appmisc.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/bastyp/frmhtmlw.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/docinf.cxx | 1 |
5 files changed, 3 insertions, 14 deletions
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index c5608c8e0e30..c9b6da55d3ea 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -183,12 +183,8 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid if(xBitmap.is()) { const uno::Reference< rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW); - - if(xIntBmp.is()) - { - rBitmap = vcl::unotools::bitmapExFromXBitmap(xIntBmp); - return true; - } + rBitmap = vcl::unotools::bitmapExFromXBitmap(xIntBmp); + return true; } } catch(const uno::Exception&) diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index be31957eafdd..970c9ced8938 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -202,7 +202,6 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, ::comphelper::getProcessComponentContext() ) ); uno::Reference<beans::XPropertySet> xUserDefinedProps( i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - DBG_ASSERT(xUserDefinedProps.is(), "UserDefinedProperties is null"); uno::Reference<beans::XPropertySetInfo> xPropInfo = xUserDefinedProps->getPropertySetInfo(); DBG_ASSERT(xPropInfo.is(), "UserDefinedProperties Info is null"); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 1d808f67c5c3..f61f2a09e682 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1764,10 +1764,6 @@ SfxDocumentMetaData::loadFromStorage( xMsf->createInstanceWithArgumentsAndContext( OUString::createFromAscii(pServiceName), args, m_xContext), css::uno::UNO_QUERY_THROW); - if (!xDocHandler.is()) - throw css::uno::RuntimeException( - "SfxDocumentMetaData::loadFromStorage:" - " cannot create XMLOasisMetaImporter service", *this); css::uno::Reference<css::document::XImporter> xImp (xDocHandler, css::uno::UNO_QUERY_THROW); xImp->setTargetDocument(css::uno::Reference<css::lang::XComponent>(this)); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 57536a51ddc1..d6ea0e8f6c54 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -4025,8 +4025,7 @@ bool SfxMedium::SwitchDocumentToFile( const OUString& aURL ) try { uno::Reference< io::XTruncate > xTruncate( pImpl->xStream, uno::UNO_QUERY_THROW ); - if ( xTruncate.is() ) - xTruncate->truncate(); + xTruncate->truncate(); if ( xOptStorage.is() ) xOptStorage->writeAndAttachToStream( pImpl->xStream ); pImpl->xStorage = xStorage; diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index e387526d33ce..41d4c380254f 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -270,7 +270,6 @@ bool SaveOlePropertySet( uno::Reference<beans::XPropertySet> xUserDefinedProps( i_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - DBG_ASSERT(xUserDefinedProps.is(), "UserDefinedProperties is null"); uno::Reference<beans::XPropertySetInfo> xPropInfo = xUserDefinedProps->getPropertySetInfo(); DBG_ASSERT(xPropInfo.is(), "UserDefinedProperties Info is null"); |