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 /tools | |
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 'tools')
-rw-r--r-- | tools/source/stream/stream.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index b688de1ec756..32babd9b7a6a 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -2045,16 +2045,16 @@ namespace { // Muessen wir Konvertieren if ( ((eLineEnd != LINEEND_LF) && (rIn[i] == '\n')) || - ((eLineEnd == LINEEND_CRLF) && (rIn[i+1] != '\n')) || + ((eLineEnd == LINEEND_CRLF) && (i+1) < nStrLen && (rIn[i+1] != '\n')) || ((eLineEnd == LINEEND_LF) && - ((rIn[i] == '\r') || (rIn[i+1] == '\r'))) || + ((rIn[i] == '\r') || ((i+1) < nStrLen && rIn[i+1] == '\r'))) || ((eLineEnd == LINEEND_CR) && - ((rIn[i] == '\n') || (rIn[i+1] == '\n'))) ) + ((rIn[i] == '\n') || ((i+1) < nStrLen && rIn[i+1] == '\n'))) ) bConvert = true; } - // skip char if \r\n oder \n\r - if ( ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) && + // skip char if \r\n or \n\r + if ( (i+1) < nStrLen && ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) && (rIn[i] != rIn[i+1]) ) ++i; } @@ -2087,7 +2087,7 @@ namespace aNewData.append('\n'); } - if ( ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) && + if ( (i+1) < nStrLen && ((rIn[i+1] == '\r') || (rIn[i+1] == '\n')) && (rIn[i] != rIn[i+1]) ) ++i; } |