diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-26 16:35:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-26 16:38:05 +0100 |
commit | 3c2c2eb46ec70c82ec63ab7cf8096db4cb4fd8a2 (patch) | |
tree | 2bdbd08005244110a1a75db5280e8fb8b6a5f9af /svtools | |
parent | 69bb7c732d9b4b80c211b031ff40c500b4b02a40 (diff) |
discard broken embedded object previews
Change-Id: I4f632545d383c4887342aa2959987d4ac3638eb4
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/misc/embedhlp.cxx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 6325a76c4ec3..135ad3055500 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -560,16 +560,25 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( sal_Bool bUpdate ) const { const sal_Int32 nConstBufferSize = 32000; SvStream *pStream = new SvMemoryStream( 32000, 32000 ); - sal_Int32 nRead=0; - uno::Sequence < sal_Int8 > aSequence ( nConstBufferSize ); - do + try + { + sal_Int32 nRead=0; + uno::Sequence < sal_Int8 > aSequence ( nConstBufferSize ); + do + { + nRead = xStream->readBytes ( aSequence, nConstBufferSize ); + pStream->Write( aSequence.getConstArray(), nRead ); + } + while ( nRead == nConstBufferSize ); + pStream->Seek(0); + return pStream; + } + catch (const uno::Exception& ex) { - nRead = xStream->readBytes ( aSequence, nConstBufferSize ); - pStream->Write( aSequence.getConstArray(), nRead ); + SAL_WARN("svtools", "discarding broken embedded object preview: " << ex.Message); + delete pStream; + xStream.clear(); } - while ( nRead == nConstBufferSize ); - pStream->Seek(0); - return pStream; } } |