basctl/source/basicide/baside2b.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 9e9e08dae1abe90d7c4d81d22065f31e5b948435
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Nov 4 22:38:44 2018 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Mon Nov 5 07:19:52 2018 +0100

    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 <[email protected]>

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() )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to