[Libreoffice-commits] core.git: cui/source

Xisco Fauli anistenis at gmail.com
Wed May 17 15:19:38 UTC 2017


 cui/source/tabpages/tpbitmap.cxx |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

New commits:
commit 9d55ce72b69934d17360142f88a699397e0aa41f
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue May 16 12:25:24 2017 +0200

    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 at yahoo.fr>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

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)


More information about the Libreoffice-commits mailing list