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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 8 20:50:54 UTC 2019


 vcl/source/gdi/FileDefinitionWidgetDraw.cxx |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 8de89e1c39b211cb4c39e47c992b03ed33003658
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Mar 8 19:44:26 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 8 21:50:26 2019 +0100

    Fix crash in widget drawing of a SVG as image
    
    Change-Id: Iaa7e01b49b9c2dcdfa98e4e8bc431dba82fe6bb4
    Reviewed-on: https://gerrit.libreoffice.org/68942
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 606417ac1ca5..abd55fb0bca0 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -329,8 +329,21 @@ void munchDrawCommands(std::vector<std::shared_ptr<DrawCommand>> const& rDrawCom
                 long nImageWidth = aBitmap.GetSizePixel().Width();
                 long nImageHeight = aBitmap.GetSizePixel().Height();
                 SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, nImageWidth, nImageHeight);
-                rGraphics.DrawBitmap(aTR, *aBitmap.GetBitmap().ImplGetSalBitmap().get(),
-                                     *aBitmap.GetAlpha().ImplGetSalBitmap().get(), nullptr);
+                if (!!aBitmap)
+                {
+                    const std::shared_ptr<SalBitmap> pSalBitmap
+                        = aBitmap.GetBitmap().ImplGetSalBitmap();
+                    if (aBitmap.IsAlpha())
+                    {
+                        const std::shared_ptr<SalBitmap> pSalBitmapAlpha
+                            = aBitmap.GetAlpha().ImplGetSalBitmap();
+                        rGraphics.DrawBitmap(aTR, *pSalBitmap, *pSalBitmapAlpha, nullptr);
+                    }
+                    else
+                    {
+                        rGraphics.DrawBitmap(aTR, *pSalBitmap, nullptr);
+                    }
+                }
             }
             break;
             case DrawCommandType::EXTERNAL:


More information about the Libreoffice-commits mailing list