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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 25 14:18:12 UTC 2020


 vcl/inc/skia/gdiimpl.hxx |    5 ++++-
 vcl/inc/skia/salbmp.hxx  |    2 ++
 vcl/inc/skia/utils.hxx   |    2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b0a7c59be05f127bc025a57ac219d329ae0072c1
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Jun 25 11:19:51 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jun 25 16:17:31 2020 +0200

    handle nullptr pointers in Skia debugging functions
    
    Change-Id: I2c500444f97f66b03cc0e0a27581ced4d1cfbf22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97102
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index eb5fbdbdcbf8..12a2366bce51 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -275,7 +275,10 @@ protected:
     template <typename charT, typename traits>
     friend inline std::basic_ostream<charT, traits>&
     operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalGraphicsImpl* graphics)
-    { // O - offscreen, G - GPU-based, R - raster
+    {
+        if (graphics == nullptr)
+            return stream << "(null)";
+        // O - offscreen, G - GPU-based, R - raster
         return stream << static_cast<const void*>(graphics) << " "
                       << Size(graphics->GetWidth(), graphics->GetHeight())
                       << (graphics->isGPU() ? "G" : "R") << (graphics->isOffscreen() ? "O" : "");
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 0761217d4eb9..2bd729683bde 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -97,6 +97,8 @@ private:
     friend inline std::basic_ostream<charT, traits>&
     operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalBitmap* bitmap)
     {
+        if (bitmap == nullptr)
+            return stream << "(null)";
         // I/i - has SkImage (on GPU/CPU),
         // A/a - has alpha SkImage (on GPU/CPU)
         return stream << static_cast<const void*>(bitmap) << " " << bitmap->GetSize() << "/"
diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx
index e0fcf70c30e7..a23a472070a9 100644
--- a/vcl/inc/skia/utils.hxx
+++ b/vcl/inc/skia/utils.hxx
@@ -122,6 +122,8 @@ template <typename charT, typename traits>
 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream,
                                                      const sk_sp<SkImage>& image)
 {
+    if (image == nullptr)
+        return stream << "(null)";
     return stream << *image;
 }
 


More information about the Libreoffice-commits mailing list