diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-05-03 19:10:31 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-05-05 10:49:42 +0200 |
commit | 0e4b219337fc4df1ae58f3f257ea3990b615f983 (patch) | |
tree | 71ffeaf6310b05ce8ea4e7f4ee59b3e6c4a3a0d2 | |
parent | 0e14dbc9ecdf6abae3ae3089e3b4e22f27dd4cb1 (diff) |
tdf#155037: check source code name exists
Otherwise, it crashes with
terminate called after throwing an instance of 'com::sun::star::container::NoSuchElementException'
Change-Id: Ic53bedcc19690d43aef20d4193e840e340e349d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151336
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 5f914d5f4b48a092736650db1e1e431787e50096)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151371
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sc/source/core/data/documen2.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a7ea162177a9..2faa9cd1c7d0 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1117,7 +1117,8 @@ sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, SCTAB nSrcPos, OUString sSrcCodeName; rSrcDoc.GetCodeName( nSrcPos, sSrcCodeName ); OUString sRTLSource; - xLib->getByName( sSrcCodeName ) >>= sRTLSource; + if (xLib->hasByName( sSrcCodeName )) + xLib->getByName( sSrcCodeName ) >>= sRTLSource; sSource = sRTLSource; } VBA_InsertModule( *this, nDestPos, sSource ); |