diff options
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 11 |
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() ) |