From 7b0d2aac03c4d78b53e109a5203afbcd4b676af8 Mon Sep 17 00:00:00 2001 From: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> Date: Wed, 16 Jun 2021 17:00:41 -0700 Subject: [PATCH] Fixed potential crash if an attachment binding doesn't connect to an attachment. (#1373) --- Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp index 3e52130f6f..fa10e1a454 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RenderPass.cpp @@ -61,6 +61,11 @@ namespace AZ { const PassAttachmentBinding& binding = m_attachmentBindings[slotIndex]; + if (!binding.m_attachment) + { + continue; + } + // Handle the depth-stencil attachment. There should be only one. if (binding.m_scopeAttachmentUsage == RHI::ScopeAttachmentUsage::DepthStencil) { @@ -98,6 +103,10 @@ namespace AZ { continue; } + if (!binding.m_attachment) + { + continue; + } if (binding.m_scopeAttachmentUsage == RHI::ScopeAttachmentUsage::RenderTarget || binding.m_scopeAttachmentUsage == RHI::ScopeAttachmentUsage::DepthStencil)