platformsupport/scenes/opengl: don't crash when importing a texture fails
CCBUG: 474933
This commit is contained in:
parent
88ab958f4d
commit
d6bc5d9b14
1 changed files with 4 additions and 2 deletions
|
@ -24,8 +24,10 @@ EglSwapchainSlot::EglSwapchainSlot(EglContext *context, GraphicsBuffer *buffer)
|
|||
: m_buffer(buffer)
|
||||
{
|
||||
m_texture = context->importDmaBufAsTexture(*buffer->dmabufAttributes());
|
||||
if (m_texture) {
|
||||
m_framebuffer = std::make_unique<GLFramebuffer>(m_texture.get());
|
||||
}
|
||||
}
|
||||
|
||||
EglSwapchainSlot::~EglSwapchainSlot()
|
||||
{
|
||||
|
@ -137,7 +139,7 @@ std::shared_ptr<EglSwapchain> EglSwapchain::create(GraphicsBufferAllocator *allo
|
|||
}
|
||||
|
||||
const QVector<std::shared_ptr<EglSwapchainSlot>> slots{std::make_shared<EglSwapchainSlot>(context, seed)};
|
||||
if (!slots.front()->framebuffer()->valid()) {
|
||||
if (!slots.front()->framebuffer() || !slots.front()->framebuffer()->valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<EglSwapchain>(std::move(allocator),
|
||||
|
|
Loading…
Reference in a new issue