summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-04 22:38:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-05 07:19:52 +0100
commit9e9e08dae1abe90d7c4d81d22065f31e5b948435 (patch)
treed0de18ec4361f635ed157a7da528aafa23536049 /basctl
parent655154e45abfe6c69b97ad5c615f231be4b3827a (diff)
tdf#120703 PVS: this fix was wrong
This partially reverts commit 2a3f5d11522cd69f0ce221cde3a63b7e85e94b53 to reimplement the proper index check. Thanks to Svyatoslav Razmyslov. Change-Id: If0928eed8ff137efbb2d7605135375d147e9accf Reviewed-on: https://gerrit.libreoffice.org/62862 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2b.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a1ec27c3d636..4c406865e3b6 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -148,10 +148,13 @@ void lcl_SeparateNameAndIndex( const OUString& rVName, OUString& rVar, OUString&
if ( nIndexStart != -1 )
{
sal_Int32 nIndexEnd = rVar.indexOf( ')', nIndexStart );
- rIndex = rVar.copy(nIndexStart + 1, nIndexEnd - nIndexStart - 1);
- rVar = rVar.copy(0, nIndexStart);
- rVar = comphelper::string::stripEnd(rVar, ' ');
- rIndex = comphelper::string::strip(rIndex, ' ');
+ if (nIndexEnd != -1)
+ {
+ rIndex = rVar.copy(nIndexStart + 1, nIndexEnd - nIndexStart - 1);
+ rVar = rVar.copy(0, nIndexStart);
+ rVar = comphelper::string::stripEnd(rVar, ' ');
+ rIndex = comphelper::string::strip(rIndex, ' ');
+ }
}
if ( !rVar.isEmpty() )