diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-03-28 13:06:36 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-03-28 13:30:41 +0100 |
commit | 7eaf1e93889568b6cd9f721b42a3fd4bbe59f8b6 (patch) | |
tree | 6618876ad976f6701e1a3915ce071ab95b78872f /l10ntools | |
parent | 4fb6281270302e26664c2aa09e63b6838dc67d87 (diff) |
Half-assed attempt at enforcing operator [] preconditions
...inspired by comments to <https://gerrit.libreoffice.org/#/c/3068/>
"String::AppendAscii cleanup in dbaccess," but it quickly becomes apparent that
lots of code rely on s[s.getLength()] == 0, so live with a weakened precondition
check for now.
Change-Id: Ifad96c706b14433df4a084ab8054b32433b8b5b6
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/lngmerge.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 052f9705ab1e..364087d4e9e3 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -194,7 +194,8 @@ sal_Bool LngParser::Merge( { rtl::OString sLine( *(*pLines)[ nPos ] ); sLine = sLine.trim(); - if (( sLine[0] == '[' ) && + if (!sLine.isEmpty() && + ( sLine[0] == '[' ) && ( sLine[sLine.getLength() - 1] == ']' )) { sGroup = getBracketedContent(sLine).trim(); @@ -220,7 +221,8 @@ sal_Bool LngParser::Merge( { rtl::OString sLine( *(*pLines)[ nPos ] ); sLine = sLine.trim(); - if (( sLine[0] == '[' ) && + if (!sLine.isEmpty() && + ( sLine[0] == '[' ) && ( sLine[sLine.getLength() - 1] == ']' )) { sGroup = getBracketedContent(sLine).trim(); |