summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-05-03 19:10:31 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-05-04 12:12:26 +0200
commitfd02cdd4b5ef0fc96225501ba8f6758af8b6c69e (patch)
tree55bd5014539aa9b2857c65ab7bfd4d528cdebc74 /sc
parent4cae4a11642f0d8f0c8005141893e34e1c216fde (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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/documen2.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index fa979a953cb8..e5d5df5a94cb 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 );