diff options
author | Xisco Fauli <anistenis@gmail.com> | 2017-05-16 12:25:24 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-05-17 17:18:57 +0200 |
commit | 9d55ce72b69934d17360142f88a699397e0aa41f (patch) | |
tree | 24a4e02ad9c42fd9087750318cf589e11d4b4c7f /cui | |
parent | c7c5a96ee3ca0fe06933b35e04983b6fef01b5f6 (diff) |
tdf#107877: Don't crash if all bitmaps are deleted
Change-Id: Ie21f8cf1ead7c75017ee09436102f87f5d5dc04c
Reviewed-on: https://gerrit.libreoffice.org/37673
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 08cc3dc2b351..1bdbe8ac7752 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -525,21 +525,29 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapHdl, ValueSet*, void) } } - BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx()); - Size aTempBitmapSize = aBmpEx.GetSizePixel(); - const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0); + if(pGraphicObject) + { + BitmapEx aBmpEx(pGraphicObject->GetGraphic().GetBitmapEx()); + Size aTempBitmapSize = aBmpEx.GetSizePixel(); + const double fUIScale = ( (mpView && mpView->GetModel()) ? double(mpView->GetModel()->GetUIScale()) : 1.0); - rBitmapSize.Width() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale); - rBitmapSize.Height() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale); - CalculateBitmapPresetSize(); - ModifyBitmapStyleHdl( *m_pBitmapStyleLB ); - ModifyBitmapPositionHdl( *m_pPositionLB ); + rBitmapSize.Width() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Width()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale); + rBitmapSize.Height() = ((OutputDevice::LogicToLogic(static_cast<sal_Int32>(aTempBitmapSize.Height()),MapUnit::MapPixel, MapUnit::Map100thMM )) / fUIScale); + CalculateBitmapPresetSize(); + ModifyBitmapStyleHdl( *m_pBitmapStyleLB ); + ModifyBitmapPositionHdl( *m_pPositionLB ); - m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - m_rXFSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); + m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); + m_rXFSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); + + m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); + m_pCtlBitmapPreview->Invalidate(); + } + else + { + SAL_WARN("cui.tabpages", "SvxBitmapTabPage::ModifyBitmapHdl(): null pGraphicObject"); + } - m_pCtlBitmapPreview->SetAttributes( m_aXFillAttr.GetItemSet() ); - m_pCtlBitmapPreview->Invalidate(); } IMPL_LINK_NOARG(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void) |