summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-12 13:47:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-12 16:43:59 +0200
commit170d7dccf10eedcddb2a4eab714ec0da9817255c (patch)
tree2a79d218180870610160b279dbc629145077711f /filter
parent47993653622f8752529e55b9271585d0525e8efd (diff)
crashtesting: asserts on empty mask
since... commit d46c32140fdb05758c039dd27552b1788faac104 Date: Thu Jun 7 12:37:33 2018 +0200 assert in BitmapInfoAccess if bitmap is empty or we can't read from it Change-Id: I5b0ed63d476f0203d5c18441ff759415192eab2f Reviewed-on: https://gerrit.libreoffice.org/55688 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/mstoolbar.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index ecfa1f7ee318..52d69b901a34 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -294,11 +294,19 @@ bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect
if ( !sCommand.isEmpty() )
{
BitmapEx aBitEx( pIcon->getBitMap() );
- if ( pSpecificInfo->getIconMask() )
- // according to the spec:
- // "the iconMask is white in all the areas in which the icon is
- // displayed as transparent and is black in all other areas."
- aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().GetBitmap().CreateMask( COL_WHITE ) );
+ TBCBitMap* pIconMask = pSpecificInfo->getIconMask();
+ if (pIconMask)
+ {
+ Bitmap aMaskBase(pIconMask->getBitMap().GetBitmap());
+ Size aMaskSize = aMaskBase.GetSizePixel();
+ if (aMaskSize.Width() && aMaskSize.Height())
+ {
+ // according to the spec:
+ // "the iconMask is white in all the areas in which the icon is
+ // displayed as transparent and is black in all other areas."
+ aBitEx = BitmapEx(aBitEx.GetBitmap(), aMaskBase.CreateMask(COL_WHITE));
+ }
+ }
Graphic aGraphic( aBitEx );
helper.addIcon( aGraphic.GetXGraphic(), sCommand );