xmloff/source/style/fonthdl.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
New commits: commit fc508908f55cc1fe5a22adcba710cebb75fc979c Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Fri Jul 13 15:15:57 2012 +0200 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 diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx index 3d58197..f4d1705 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
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits