diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-20 16:06:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-21 09:49:47 +0200 |
commit | ee37679d446edb82e9a2f848ae35788074cf26c0 (patch) | |
tree | cafe5b83db8642cbc5468e8c52b9db42558d4a1e /sfx2 | |
parent | 498f464ea7d60698192ec609fa4ee856123814a4 (diff) |
cheaper to check for null return rather than catch exception
Change-Id: Ifdbcbacc3d1340c77529ccacf4aaebf3dd250350
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134698
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index fb6cca399cec..c83a446a8b22 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -1032,8 +1032,10 @@ SfxObjectShell* SfxObjectShell::GetShellFromComponent(const Reference<uno::XInte { try { - Reference<lang::XUnoTunnel> xTunnel(xComp, UNO_QUERY_THROW); - Sequence <sal_Int8> aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); + Reference<lang::XUnoTunnel> xTunnel(xComp, UNO_QUERY); + if (!xTunnel) + return nullptr; + static const Sequence <sal_Int8> aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); return comphelper::getSomething_cast<SfxObjectShell>(xTunnel->getSomething(aSeq)); } catch (const Exception&) |