From 5708534b942c1d0ce384f6a8473da6bb569410e7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 7 Jun 2018 13:03:58 +0200 Subject: 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 Reviewed-by: Tor Lillqvist Reviewed-by: Mike Kaganski --- sc/qa/extras/scdatapilottableobj.cxx | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sc/qa/extras/scdatapilottableobj.cxx') diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx index ebc14b04191b..b9896862fa73 100644 --- a/sc/qa/extras/scdatapilottableobj.cxx +++ b/sc/qa/extras/scdatapilottableobj.cxx @@ -82,7 +82,6 @@ ScDataPilotTableObj::ScDataPilotTableObj() uno::Reference< uno::XInterface > ScDataPilotTableObj::init() { uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); @@ -95,13 +94,11 @@ uno::Reference< uno::XInterface > ScDataPilotTableObj::init() CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is()); uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDPTS.is()); uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables(); CPPUNIT_ASSERT(xDPT.is()); uno::Reference< sheet::XDataPilotTable > xDPTable(xDPT->getByName("DataPilotTable"),UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDPTable.is()); return xDPTable; } @@ -126,13 +123,11 @@ uno::Reference< uno::XInterface > ScDataPilotTableObj::initDP2() CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is()); uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDPTS.is()); uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables(); CPPUNIT_ASSERT(xDPT.is()); uno::Reference< sheet::XDataPilotTable > xDPTable(xDPT->getByName("DataPilotTable2"),UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDPTable.is()); return xDPTable; } -- cgit