diff options
Diffstat (limited to 'sw/source/ui/vba')
-rw-r--r-- | sw/source/ui/vba/vbadocument.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/vba/vbarange.cxx | 5 |
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&) |