summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-17 18:21:58 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-03-05 22:27:39 +0100
commit9e1dfe405cd597c80d63a2138c36cebd4e98400e (patch)
tree6b68d524315ff1d58cc579aaff5eb36b053f3d3f /sc
parent234f4ef41b6dd634471dbe0c727e468c2e328acc (diff)
Index returned by getToken is always lower than string length
Also take care of handling possibly empty strings, for which the initial 0 index would fail the comparison. Change-Id: I280fac697554f2a4513a641ac258b1d2baf803f4 Reviewed-on: https://gerrit.libreoffice.org/68117 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/oox/pagesettings.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index 32d6ddc55478..7afa498e828e 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -823,9 +823,9 @@ void HeaderFooterParser::convertFontName( const OUString& rName )
void HeaderFooterParser::convertFontStyle( const OUString& rStyle )
{
maFontModel.mbBold = maFontModel.mbItalic = false;
- sal_Int32 nPos = 0;
- sal_Int32 nLen = rStyle.getLength();
- while( (0 <= nPos) && (nPos < nLen) )
+ if (rStyle.isEmpty())
+ return;
+ for( sal_Int32 nPos{ 0 }; nPos>=0; )
{
OString aToken = OUStringToOString( rStyle.getToken( 0, ' ', nPos ), RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase();
if( !aToken.isEmpty() )