summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-01-27 09:05:35 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-01-27 11:06:18 +0100
commit26d7f3440a0c9dd179ad407d48ce747699d678dd (patch)
tree9180f3c23171ea9556b78ccc23aba6a9de38bcf5 /sc
parenta714dfbfb266839633156ef02669ee2c919d1615 (diff)
Fix copying named DB when it doesn't contain a '_'
Follow-up for d9472a5284fde7bb96823655efcb6eb31f405493 Change-Id: Ib97d2c81159ddcf60604558f38e87af59cef86dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129023 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/dbdata.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index b87e388e79fc..25dc833e3732 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -998,7 +998,9 @@ OUString lcl_IncrementNumberInNamedRange(ScDBCollection::NamedDBs& namedDBs,
const OUString& sOldName,bool bIsUpperName)
{
sal_Int32 lastIndex = sOldName.lastIndexOf('_');
- sal_Int32 nOldNumber = OUString(sOldName.subView(lastIndex)).toInt32();
+ sal_Int32 nOldNumber = 0;
+ if (lastIndex >= 0)
+ nOldNumber = OUString(sOldName.subView(lastIndex)).toInt32();
OUString sNewName;
do
{