From 1d819e25917a41a5f619195c6c1070b07bd83f90 Mon Sep 17 00:00:00 2001 From: amzn-sj Date: Mon, 3 Jan 2022 11:50:49 -0800 Subject: [PATCH] Fix crash caused by trying to dereference a nullptr Early return if input attachment is null (#6590) Signed-off-by: amzn-sj --- .../Common/Code/Source/CoreLights/EsmShadowmapsPass.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/EsmShadowmapsPass.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/EsmShadowmapsPass.cpp index b92d538fb5..553133aef7 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/EsmShadowmapsPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/EsmShadowmapsPass.cpp @@ -101,6 +101,13 @@ namespace AZ void EsmShadowmapsPass::UpdateChildren() { const RPI::PassAttachmentBinding& inputBinding = GetInputBinding(0); + + if (!inputBinding.m_attachment) + { + AZ_Assert(false, "[EsmShadowmapsPass %s] requires an input attachment", GetPathName().GetCStr()); + return; + } + AZ_Assert(inputBinding.m_attachment->m_descriptor.m_type == RHI::AttachmentType::Image, "[EsmShadowmapsPass %s] input attachment requires an image attachment", GetPathName().GetCStr()); m_shadowmapImageSize = inputBinding.m_attachment->m_descriptor.m_image.m_size; m_shadowmapArraySize = inputBinding.m_attachment->m_descriptor.m_image.m_arraySize;