diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-11 11:06:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-25 07:19:13 +0100 |
commit | b1cfdb7bee4f7af97af54e6abbc5d04aed4ba082 (patch) | |
tree | 8211ea564e36152b9eeb7be7212342d9e82800c6 /svx | |
parent | 26b81b23f0ad061b6d44fcea3e07ae4b18a63f94 (diff) |
new loplugin:unoquery
look for places we are doing code like:
Reference<XProperty>(model, css::uno::UNO_QUERY)->getAsProperty()
which might result in a SIGSEGV is the query fails
Change-Id: I5cbdbc9e64bd0bed588297c512bf60cbacb9442e
Reviewed-on: https://gerrit.libreoffice.org/69044
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 8 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/formcontroller.cxx | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 6108564cea87..cf061a1697a8 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -559,10 +559,10 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >& Reference< css::sdbcx::XColumnsSupplier > xColumnsSupplier(xForm, UNO_QUERY); if (xColumnsSupplier.is()) { - if (Reference< XIndexAccess > (xColumnsSupplier->getColumns(),UNO_QUERY)->getCount()) + if (Reference< XIndexAccess > (xColumnsSupplier->getColumns(),UNO_QUERY_THROW)->getCount()) { // we get only a new bookmark if the resultset is not forwardonly - if (::comphelper::getINT32(Reference< XPropertySet > (xForm, UNO_QUERY)->getPropertyValue(FM_PROP_RESULTSET_TYPE)) != ResultSetType::FORWARD_ONLY) + if (::comphelper::getINT32(Reference< XPropertySet > (xForm, UNO_QUERY_THROW)->getPropertyValue(FM_PROP_RESULTSET_TYPE)) != ResultSetType::FORWARD_ONLY) { // as the FmGridControl touches the data source it is connected to we have to remember the current // cursor position (and restore afterwards) @@ -572,7 +572,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< css::awt::XToolkit >& { try { - aOldCursorBookmark = Reference< css::sdbcx::XRowLocate > (xForm, UNO_QUERY)->getBookmark(); + aOldCursorBookmark = Reference< css::sdbcx::XRowLocate > (xForm, UNO_QUERY_THROW)->getBookmark(); } catch( const Exception& ) { @@ -1512,7 +1512,7 @@ void FmXGridPeer::cursorMoved(const EventObject& _rEvent) VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); // we are not interested in move to insert row only in the resetted event // which is fired after positioning an the insert row - if (pGrid && pGrid->IsOpen() && !::comphelper::getBOOL(Reference< XPropertySet > (_rEvent.Source, UNO_QUERY)->getPropertyValue(FM_PROP_ISNEW))) + if (pGrid && pGrid->IsOpen() && !::comphelper::getBOOL(Reference< XPropertySet > (_rEvent.Source, UNO_QUERY_THROW)->getPropertyValue(FM_PROP_ISNEW))) pGrid->positioned(); } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 6ea74294722e..ef8b5d0e4cce 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -1419,7 +1419,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, DbGridCo // is the new cursor valid ? // the cursor is only valid if it contains some columns // if there is no cursor or the cursor is not valid we have to clean up an leave - if (!_xCursor.is() || !Reference< XColumnsSupplier > (_xCursor, UNO_QUERY)->getColumns()->hasElements()) + if (!_xCursor.is() || !Reference< XColumnsSupplier > (_xCursor, UNO_QUERY_THROW)->getColumns()->hasElements()) { RemoveRows(); return; diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index eb9b9303497e..a5dc8c9073f1 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1156,7 +1156,7 @@ void FormController::disposing() } } - Reference< XComponent > (rpChild, UNO_QUERY)->dispose(); + Reference< XComponent > (rpChild, UNO_QUERY_THROW)->dispose(); } m_aChildren.clear(); |