sc/source/core/data/documen2.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit fd02cdd4b5ef0fc96225501ba8f6758af8b6c69e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed May 3 19:10:31 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu May 4 12:12:26 2023 +0200 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 <caol...@redhat.com> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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 );