From 615e3502c5217585501dac27318a2f22847a5605 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Wed, 20 Apr 2016 20:00:32 +0900 Subject: Resolves: tdf#88320 parsing fails with a subscript number ... ending with comma and followed by non-space. Change-Id: Ia00c662e31940270690c64e1840417436565a6c7 Reviewed-on: https://gerrit.libreoffice.org/24260 Tested-by: Jenkins Reviewed-by: Takeshi Abe --- starmath/source/parse.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'starmath/source/parse.cxx') diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index ada838aeffa2..6a7d76b5f02e 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -460,6 +460,14 @@ void SmParser::NextToken() } else if (aRes.TokenType & KParseType::ANY_NUMBER) { + assert(aRes.EndPos > 0); + if ( m_aBufferString[aRes.EndPos-1] == ',' && + aRes.EndPos < nBufLen && + aCC.getType( m_aBufferString, aRes.EndPos ) != UnicodeType::SPACE_SEPARATOR ) + { + // Comma followed by a non-space char is unlikely for decimal/thousands separator. + --aRes.EndPos; + } sal_Int32 n = aRes.EndPos - nRealStart; OSL_ENSURE( n >= 0, "length < 0" ); m_aCurToken.eType = TNUMBER; -- cgit v1.2.3