From f12961bf687b6c0c7d7717ea24c81735976d0f2c Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Thu, 11 Aug 2022 17:51:11 -0700 Subject: [PATCH] [Impeller] Trivial nullptr de-reference fix (flutter/engine#35361) --- engine/src/flutter/impeller/entity/entity_pass.cc | 5 +++++ engine/src/flutter/impeller/entity/inline_pass_context.cc | 3 +++ 2 files changed, 8 insertions(+) diff --git a/engine/src/flutter/impeller/entity/entity_pass.cc b/engine/src/flutter/impeller/entity/entity_pass.cc index 9d957c3686..2a317b042f 100644 --- a/engine/src/flutter/impeller/entity/entity_pass.cc +++ b/engine/src/flutter/impeller/entity/entity_pass.cc @@ -365,6 +365,11 @@ bool EntityPass::OnRender(ContentContext& renderer, stencil_depth_floor); auto pass = pass_context.GetRenderPass(pass_depth); + + if (!pass) { + return false; + } + if (!element_entity.ShouldRender(pass->GetRenderTargetSize())) { return true; // Nothing to render. } diff --git a/engine/src/flutter/impeller/entity/inline_pass_context.cc b/engine/src/flutter/impeller/entity/inline_pass_context.cc index fa0f38135e..26661e8d81 100644 --- a/engine/src/flutter/impeller/entity/inline_pass_context.cc +++ b/engine/src/flutter/impeller/entity/inline_pass_context.cc @@ -4,6 +4,7 @@ #include "impeller/entity/inline_pass_context.h" +#include "impeller/base/validation.h" #include "impeller/renderer/command_buffer.h" namespace impeller { @@ -61,6 +62,7 @@ std::shared_ptr InlinePassContext::GetRenderPass( if (!IsActive()) { command_buffer_ = context_->CreateCommandBuffer(); if (!command_buffer_) { + VALIDATION_LOG << "Could not create command buffer."; return nullptr; } @@ -85,6 +87,7 @@ std::shared_ptr InlinePassContext::GetRenderPass( pass_ = command_buffer_->CreateRenderPass(render_target_); if (!pass_) { + VALIDATION_LOG << "Could not create render pass."; return nullptr; }