summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-07-13 15:15:57 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-07-13 15:21:57 +0200
commit0054c76b0f3d5bdbaef73a696ce3cf930be9c16b (patch)
treec8e835dc28d1e63e432c93f9e20b523d4590db0a /xmloff
parentd22ec2d67e82ebc7723f018172911ff4e567c006 (diff)
fix a crash with empty string
If it's named nLast, then it's supposed to point to the last character, which, with an empty string, logically means it should point before the start of the string. Change-Id: I248fbe80c1c4b1c2c8d39f0bcf772f9b85415e4a Signed-off-by: Miklos Vajna <vmiklos@suse.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/fonthdl.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
index 3d581977305c..f4d1705fa357 100644
--- a/xmloff/source/style/fonthdl.cxx
+++ b/xmloff/source/style/fonthdl.cxx
@@ -85,12 +85,10 @@ sal_Bool XMLFontFamilyNamePropHdl::importXML( const OUString& rStrImpValue, uno:
{
sal_Int32 nFirst = nPos;
nPos = ::sax::Converter::indexOfComma( rStrImpValue, nPos );
- sal_Int32 nLast = (-1 == nPos ? rStrImpValue.getLength() : nPos);
- if( nLast > 0 )
- nLast--;
+ sal_Int32 nLast = (-1 == nPos ? rStrImpValue.getLength() - 1 : nPos - 1);
// skip trailing blanks
- while( sal_Unicode(' ') == rStrImpValue[nLast] && nLast > nFirst )
+ while( nLast > nFirst && sal_Unicode(' ') == rStrImpValue[nLast] )
nLast--;
// skip leading blanks