diff options
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/mathtype.cxx | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 43602a491d03..72c3bed94edb 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -558,28 +558,36 @@ bool MathType::Parse(SvStream* pStream) pS = pStream; pS->SetEndian( SvStreamEndian::LITTLE ); - EQNOLEFILEHDR aHdr; - aHdr.Read(pS); - sal_uInt8 nProdVersion; - sal_uInt8 nProdSubVersion; - sal_uInt8 nPlatform; - sal_uInt8 nProduct; - pS->ReadUChar( nVersion ); - pS->ReadUChar( nPlatform ); - pS->ReadUChar( nProduct ); - pS->ReadUChar( nProdVersion ); - pS->ReadUChar( nProdSubVersion ); - - if (nVersion > 3) // allow only supported versions of MathType to be parsed - return false; - - bool bRet = HandleRecords(0); - //little crude hack to close occasionally open expressions - //a sophisticated system to determine what expressions are - //opened is required, but this is as much work as rewriting - //starmaths internals. - rRet.append("{}"); + bool bRet; + try + { + EQNOLEFILEHDR aHdr; + aHdr.Read(pS); + sal_uInt8 nProdVersion; + sal_uInt8 nProdSubVersion; + sal_uInt8 nPlatform; + sal_uInt8 nProduct; + pS->ReadUChar( nVersion ); + pS->ReadUChar( nPlatform ); + pS->ReadUChar( nProduct ); + pS->ReadUChar( nProdVersion ); + pS->ReadUChar( nProdSubVersion ); + + if (nVersion > 3) // allow only supported versions of MathType to be parsed + return false; + bRet = HandleRecords(0); + //little crude hack to close occasionally open expressions + //a sophisticated system to determine what expressions are + //opened is required, but this is as much work as rewriting + //starmaths internals. + rRet.append("{}"); + } + catch (const SvStreamEOFException&) + { + SAL_WARN("starmath", "EOF"); + bRet = false; + } return bRet; } |