diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-20 09:37:40 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-20 09:52:41 +0200 |
commit | 30a6622ca8046691d57eb5c422da7646edcb0cb1 (patch) | |
tree | 88f23a44558e7f9d1d672c3d0f0ab0803e60d3d2 | |
parent | writerfilter: remove newly unused methods (diff) | |
download | core-30a6622ca8046691d57eb5c422da7646edcb0cb1.tar.gz core-30a6622ca8046691d57eb5c422da7646edcb0cb1.zip |
CID#1295034 uncaught exception
Change-Id: I853e520dd60c3e19cbf7a7b620115df50fc25b30
-rw-r--r-- | starmath/source/unofilter.cxx | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx index 4058609ab2bb..423c46c7ee4f 100644 --- a/starmath/source/unofilter.cxx +++ b/starmath/source/unofilter.cxx @@ -64,34 +64,41 @@ MathTypeFilter::~MathTypeFilter() sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescriptor) throw(uno::RuntimeException, std::exception) { bool bSuccess = false; - utl::MediaDescriptor aMediaDesc(rDescriptor); - aMediaDesc.addInputStream(); - uno::Reference<io::XInputStream> xInputStream; - aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream; - std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream)); - if (pStream) + try { - if (SotStorage::IsStorageFile(pStream.get())) + utl::MediaDescriptor aMediaDesc(rDescriptor); + aMediaDesc.addInputStream(); + uno::Reference<io::XInputStream> xInputStream; + aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream; + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream)); + if (pStream) { - SvStorageRef aStorage(new SotStorage(pStream.get(), false)); - // Is this a MathType Storage? - if (aStorage->IsStream(OUString("Equation Native"))) + if (SotStorage::IsStorageFile(pStream.get())) { - if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get())) + SvStorageRef aStorage(new SotStorage(pStream.get(), false)); + // Is this a MathType Storage? + if (aStorage->IsStream(OUString("Equation Native"))) { - SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - OUString aText = pDocShell->GetText(); - MathType aEquation(aText); - bSuccess = aEquation.Parse(aStorage) == 1; - if (bSuccess) + if (SmModel* pModel = dynamic_cast<SmModel*>(m_xDstDoc.get())) { - pDocShell->SetText(aText); - pDocShell->Parse(); + SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); + OUString aText = pDocShell->GetText(); + MathType aEquation(aText); + bSuccess = aEquation.Parse(aStorage) == 1; + if (bSuccess) + { + pDocShell->SetText(aText); + pDocShell->Parse(); + } } } } } } + catch (const uno::Exception& rException) + { + SAL_WARN("starmath", "Exception caught: " << rException.Message); + } return bSuccess; } |