diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-21 09:53:57 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-10-23 13:12:55 +0200 |
commit | 8396cce9b5d9a4e3cdccc558eb1b818460f0987a (patch) | |
tree | c573d21f50405516245cbfc11630c589a098a855 /basic | |
parent | 763114f8b7a7705e1b28226da33bf00016ad7982 (diff) |
clean up places accessing the NULL at the of an OUString
There were only a couple of real bugs fixed, but we're a little
bit safer now.
This also fixes the assert and the comment in OUString::operator[]
about this.
Change-Id: Ibe16b5794e0ba7ecd345fa0801586d25b015974c
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/comp/scanner.cxx | 17 | ||||
-rw-r--r-- | basic/source/comp/token.cxx | 5 |
2 files changed, 13 insertions, 9 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 0a5a4932f99f..3609765b3630 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -401,13 +401,16 @@ bool SbiScanner::NextSym() GenError( SbERR_MATH_OVERFLOW ); // type recognition? - SbxDataType t(GetSuffixType(aLine[nCol])); - if( t != SbxVARIANT ) + if( nCol < aLine.getLength() ) { - eScanType = t; - ++pLine; - ++nCol; - } + SbxDataType t(GetSuffixType(aLine[nCol])); + if( t != SbxVARIANT ) + { + eScanType = t; + ++pLine; + ++nCol; + } + } } // Hex/octal number? Read in and convert: @@ -531,7 +534,7 @@ bool SbiScanner::NextSym() PrevLineCommentLbl: if( bPrevLineExtentsComment || (eScanType != SbxSTRING && - ( aSym[0] == '\'' || aSym.equalsIgnoreAsciiCase( "REM" ) ) ) ) + ( aSym.startsWith("'") || aSym.equalsIgnoreAsciiCase( "REM" ) ) ) ) { bPrevLineExtentsComment = false; aSym = OUString("REM"); diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index beff37d7f6c3..bf5231a0a571 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -344,9 +344,10 @@ SbiToken SbiTokenizer::Next() return eCurTok = EOLN; } - if( aSym[0] == '\n' ) + if( aSym.startsWith("\n") ) { - bEos = true; return eCurTok = EOLN; + bEos = true; + return eCurTok = EOLN; } bEos = false; |