From d6bc5d9b14d8b7f5c7082aed3102b84c16148514 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 27 Sep 2023 17:45:19 +0200 Subject: [PATCH] platformsupport/scenes/opengl: don't crash when importing a texture fails CCBUG: 474933 --- src/platformsupport/scenes/opengl/eglswapchain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/scenes/opengl/eglswapchain.cpp b/src/platformsupport/scenes/opengl/eglswapchain.cpp index 1f1d499a2e..5db6db24a6 100644 --- a/src/platformsupport/scenes/opengl/eglswapchain.cpp +++ b/src/platformsupport/scenes/opengl/eglswapchain.cpp @@ -24,7 +24,9 @@ EglSwapchainSlot::EglSwapchainSlot(EglContext *context, GraphicsBuffer *buffer) : m_buffer(buffer) { m_texture = context->importDmaBufAsTexture(*buffer->dmabufAttributes()); - m_framebuffer = std::make_unique(m_texture.get()); + if (m_texture) { + m_framebuffer = std::make_unique(m_texture.get()); + } } EglSwapchainSlot::~EglSwapchainSlot() @@ -137,7 +139,7 @@ std::shared_ptr EglSwapchain::create(GraphicsBufferAllocator *allo } const QVector> slots{std::make_shared(context, seed)}; - if (!slots.front()->framebuffer()->valid()) { + if (!slots.front()->framebuffer() || !slots.front()->framebuffer()->valid()) { return nullptr; } return std::make_shared(std::move(allocator),