diff options
author | Xisco Fauli <anistenis@gmail.com> | 2017-05-16 12:25:24 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-05-30 09:41:22 +0200 |
commit | 8f515f7d5a9da67c80bd5cbdb69deb3179a2a690 (patch) | |
tree | 5527a453e1dfb7f79be2c3fe04cccb151aba399f /cui | |
parent | f5a6844e683f8d97c60f5cf19aab00d41209cfc3 (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>
(cherry picked from commit 9d55ce72b69934d17360142f88a699397e0aa41f)
Reviewed-on: https://gerrit.libreoffice.org/37724
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 221de7cfdb6c6b6a4879162652bf842c4358f9eb)
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 a703aef8ede2..5f56ad4a487c 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) |