From aaffd459cede4a3f3a4119be9d7038b9beec1793 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 10 Oct 2023 21:55:44 +0200 Subject: [PATCH] backends/drm: add more nullptr checks for m_surface BUG: 475380 --- src/backends/drm/drm_egl_layer_surface.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backends/drm/drm_egl_layer_surface.cpp b/src/backends/drm/drm_egl_layer_surface.cpp index 0bbd938f42..c2045e5abe 100644 --- a/src/backends/drm/drm_egl_layer_surface.cpp +++ b/src/backends/drm/drm_egl_layer_surface.cpp @@ -191,12 +191,16 @@ EglGbmBackend *EglGbmLayerSurface::eglBackend() const std::shared_ptr EglGbmLayerSurface::currentBuffer() const { - return m_surface->currentFramebuffer; + return m_surface ? m_surface->currentFramebuffer : nullptr; } const ColorDescription &EglGbmLayerSurface::colorDescription() const { - return m_surface->shadowTexture ? m_surface->intermediaryColorDescription : m_surface->targetColorDescription; + if (m_surface) { + return m_surface->shadowTexture ? m_surface->intermediaryColorDescription : m_surface->targetColorDescription; + } else { + return ColorDescription::sRGB; + } } bool EglGbmLayerSurface::doesSurfaceFit(const QSize &size, const QMap> &formats) const @@ -206,7 +210,11 @@ bool EglGbmLayerSurface::doesSurfaceFit(const QSize &size, const QMap EglGbmLayerSurface::texture() const { - return m_surface->shadowTexture ? m_surface->shadowTexture : m_surface->currentSlot->texture(); + if (m_surface) { + return m_surface->shadowTexture ? m_surface->shadowTexture : m_surface->currentSlot->texture(); + } else { + return nullptr; + } } std::shared_ptr EglGbmLayerSurface::renderTestBuffer(const QSize &bufferSize, const QMap> &formats)