summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emfio/source/emfuno/xemfparser.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index e9175de10d60..86edeb0aa944 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -139,21 +139,28 @@ namespace emfio
bool bReadError(false);
- if (nMetaType == 0x464d4520)
+ try
{
- // read and get possible failure/error, ReadEnhWMF returns success
- bReadError = !emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
- }
- else
- {
- emfio::WmfReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader : nullptr).ReadWMF();
+ if (nMetaType == 0x464d4520)
+ {
+ // read and get possible failure/error, ReadEnhWMF returns success
+ bReadError = !emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
+ }
+ else
+ {
+ emfio::WmfReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader : nullptr).ReadWMF();
- // Need to check for ErrCode at stream to not lose former work.
- // This may contain important information and will behave the
- // same as before. When we have an error, do not create content
- ErrCode aErrCode(pStream->GetError());
+ // Need to check for ErrCode at stream to not lose former work.
+ // This may contain important information and will behave the
+ // same as before. When we have an error, do not create content
+ ErrCode aErrCode(pStream->GetError());
- bReadError = aErrCode.IsError();
+ bReadError = aErrCode.IsError();
+ }
+ }
+ catch (...)
+ {
+ bReadError = true;
}
pStream->SetEndian(nOrigNumberFormat);