[Libreoffice-commits] .: Branch 'libreoffice-3-5' - svtools/source
Petr Mladek
pmladek at kemper.freedesktop.org
Fri Jul 27 02:23:51 PDT 2012
svtools/source/misc/embedhlp.cxx | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
New commits:
commit 44bc6b5cac723b52df40fbef026e99b7119d8a69
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jul 26 16:51:58 2012 +0100
discard broken embedded object previews
Change-Id: Idbce67d16ed3e72395e130b1c4aa1d6977acd74b
Signed-off-by: Petr Mladek <pmladek at suse.cz>
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 6db4edc..ca2ed9d 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -561,16 +561,24 @@ 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 );
+ delete pStream;
+ xStream.clear();
}
- while ( nRead == nConstBufferSize );
- pStream->Seek(0);
- return pStream;
}
}
More information about the Libreoffice-commits
mailing list