diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-06-25 11:19:51 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-06-25 16:17:31 +0200 |
commit | b0a7c59be05f127bc025a57ac219d329ae0072c1 (patch) | |
tree | df3fa536c6ee1a4e6f0bf490a7653bcdd02d92f2 /vcl/inc | |
parent | 2eeb6822110205f76eb908b5900526723cc8007c (diff) |
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@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/skia/salbmp.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/skia/utils.hxx | 2 |
3 files changed, 8 insertions, 1 deletions
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; } |