From 8089b6469b2d62fa8954a02f348ed9ac4a8a9192 Mon Sep 17 00:00:00 2001 From: Peng Date: Fri, 11 Jun 2021 17:14:31 -0700 Subject: [PATCH] ATOM-15774 [RHI][Vulkan] Fix issue with null image that is released prior to creating image view. JIRA: https://jira.agscollab.com/browse/ATOM-15774 --- Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp index 605f61fc33..ec58b5c940 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImageView.cpp @@ -55,7 +55,11 @@ namespace AZ const auto& image = static_cast(resourceBase); const RHI::ImageViewDescriptor& descriptor = GetDescriptor(); - AZ_Assert(image.GetNativeImage() != VK_NULL_HANDLE, "Image has not been initialized."); + // this can happen when image has been invalidated/released right before re-compiling the image + if (image.GetNativeImage() == VK_NULL_HANDLE) + { + return RHI::ResultCode::Fail; + } RHI::Format viewFormat = descriptor.m_overrideFormat; // If an image is not owner of native image, it is a swapchain image.