diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-07 12:37:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-07 13:50:16 +0200 |
commit | d46c32140fdb05758c039dd27552b1788faac104 (patch) | |
tree | 6ac851cbc4ab242f63298fd41d90b8d60bde4c91 /emfio | |
parent | 77a01802d1a0452814718789bb0c76adeeb747c0 (diff) |
assert in BitmapInfoAccess if bitmap is empty or we can't read from it
and fixup the "make unique if two things want to write to bitmap at same
time" check, it was using maBitmap before maBitmap has been assigned
to.
Lets just make it check something more useful, like the share count of
the underlying SalBitmap.
Change-Id: I97a629457174da2e4df1edc9674290aa9c9a2b52
Reviewed-on: https://gerrit.libreoffice.org/55416
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'emfio')
-rw-r--r-- | emfio/source/reader/wmfreader.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 4d5161ed46b9..83e7ca6e81d7 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -805,9 +805,9 @@ namespace emfio mpInputStream->ReadUInt16( nFunction ).ReadUInt16( nFunction ); ReadDIB(aBmp, *mpInputStream, false); - Bitmap::ScopedReadAccess pBmp(aBmp); - if ( pBmp ) + if ( !!aBmp ) { + Bitmap::ScopedReadAccess pBmp(aBmp); for ( long y = 0; y < pBmp->Height(); y++ ) { for ( long x = 0; x < pBmp->Width(); x++ ) @@ -822,7 +822,6 @@ namespace emfio nCount = pBmp->Height() * pBmp->Width(); if ( !nCount ) nCount++; - pBmp.reset(); } Color aColor( static_cast<sal_uInt8>( nRed / nCount ), static_cast<sal_uInt8>( nGreen / nCount ), static_cast<sal_uInt8>( nBlue / nCount ) ); CreateObject(o3tl::make_unique<WinMtfFillStyle>( aColor, false )); |