summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-10-21 09:53:57 +0200
committerNoel Grandin <noel@peralex.com>2013-10-23 13:12:55 +0200
commit8396cce9b5d9a4e3cdccc558eb1b818460f0987a (patch)
treec573d21f50405516245cbfc11630c589a098a855 /vcl
parent763114f8b7a7705e1b28226da33bf00016ad7982 (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 'vcl')
-rw-r--r--vcl/source/gdi/outdev3.cxx2
-rw-r--r--vcl/source/window/mnemonic.cxx6
2 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index a9de9725edfe..d8ec0e69aef1 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -4843,7 +4843,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
nBreakPos++;
nPos = nBreakPos;
- if ( ( rStr[ nPos ] == '\r' ) || ( rStr[ nPos ] == '\n' ) )
+ if ( nPos < nLen && ( ( rStr[ nPos ] == '\r' ) || ( rStr[ nPos ] == '\n' ) ) )
{
nPos++;
// CR/LF?
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index 0b55245d146b..fe45ae8928cd 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -208,14 +208,14 @@ OUString MnemonicGenerator::CreateMnemonic( const OUString& _rKey )
}
// Search for next word
- do
+ nIndex++;
+ while ( nIndex < nLen )
{
- nIndex++;
c = aKey[ nIndex ];
if ( c == ' ' )
break;
+ nIndex++;
}
- while ( nIndex < nLen );
nIndex++;
}
while ( nIndex < nLen );