summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-08-13 13:29:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-08-14 12:56:50 +0200
commit14b7b50701e3874034f7f98a73794ba8a79792bf (patch)
treed94492a3b9b19349edb10ba580f4e0ee60fa6953 /sw/source/ui/vba
parentefe65eaaacfd155bfc38b91f51ed4e7e1d41c659 (diff)
use less exception throwing for flow control
Change-Id: I289f1a2204af02576a585392b7f428a5dc65cf1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171850 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw/source/ui/vba')
-rw-r--r--sw/source/ui/vba/vbadocument.cxx14
-rw-r--r--sw/source/ui/vba/vbarange.cxx5
2 files changed, 13 insertions, 6 deletions
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 2588c153788a..c7a110d016ef 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -692,13 +692,19 @@ SwVbaDocument::getFormControls() const
uno::Reference< container::XNameAccess > xFormControls;
try
{
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
- uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY );
+ if (!xDrawPageSupplier)
+ return xFormControls;
+ uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY );
+ if (!xFormSupplier)
+ return xFormControls;
+ uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY );
+ if (!xIndexAccess)
+ return xFormControls;
// get the www-standard container ( maybe we should access the
// 'www-standard' by name rather than index, this seems an
// implementation detail
- xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
+ xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
}
catch(const uno::Exception&)
{
diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx
index 39d369c92144..722dcfce92b1 100644
--- a/sw/source/ui/vba/vbarange.cxx
+++ b/sw/source/ui/vba/vbarange.cxx
@@ -134,8 +134,9 @@ SwVbaRange::setText( const OUString& rText )
uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
if( xBookmark.is() )
{
- uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
- sName = xNamed->getName();
+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY );
+ if (xNamed)
+ sName = xNamed->getName();
}
}
catch (const uno::Exception&)