diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-09-30 19:21:10 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-10-01 11:45:01 +0200 |
commit | dc7ca91a0494713a057da33cf33f1a83640f6a75 (patch) | |
tree | 46fdf4ce3ce9d4a8571f7dd26698d6e02b0669b8 /basic/source | |
parent | loplugin:implicitboolconversion (diff) | |
download | core-dc7ca91a0494713a057da33cf33f1a83640f6a75.tar.gz core-dc7ca91a0494713a057da33cf33f1a83640f6a75.zip |
avoid calling OUString::copy() with length being -1
Which asserts in dbgutil build.
Change-Id: I0f8205ae98c5a57c430b7d8a574e4c0019855841
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/comp/scanner.cxx | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 042518d394f4..6065e2692069 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -491,25 +491,28 @@ bool SbiScanner::NextSym() if( *pLine == cSep ) { pLine++; nCol++; - if( *pLine != cSep || cSep == ']' ) break; + if( *pLine != cSep || cSep == ']' ) + { + // If VBA Interop then doen't eat the [] chars + if ( cSep == ']' && bVBASupportOn ) + aSym = aLine.copy( n - 1, nCol - n + 1); + else + aSym = aLine.copy( n, nCol - n - 1 ); + // get out duplicate string delimiters + OUStringBuffer aSymBuf; + for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i ) + { + aSymBuf.append( aSym[i] ); + if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep ) + ++i; + } + aSym = aSymBuf.makeStringAndClear(); + if( cSep != ']' ) + eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING; + break; + } } else aError = OUString(cSep), GenError( SbERR_EXPECTED ); } - // If VBA Interop then doen't eat the [] chars - if ( cSep == ']' && bVBASupportOn ) - aSym = aLine.copy( n - 1, nCol - n + 1); - else - aSym = aLine.copy( n, nCol - n - 1 ); - // get out duplicate string delimiters - OUStringBuffer aSymBuf; - for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i ) - { - aSymBuf.append( aSym[i] ); - if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep ) - ++i; - } - aSym = aSymBuf.makeStringAndClear(); - if( cSep != ']' ) - eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING; } // invalid characters: else if( ( *pLine & 0xFF ) >= 0x7F ) |