From ecef0e88f3d71fb3e226b2cd0430e7a1f4203a6a Mon Sep 17 00:00:00 2001 From: mriegger Date: Thu, 13 May 2021 21:04:15 -0700 Subject: [PATCH] Fixing clone function --- .../Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp index 24857f8d65..e4bb379c6a 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/DecalTextureArrayFeatureProcessor.cpp @@ -134,7 +134,10 @@ namespace AZ { m_decalData.GetData(decal.GetIndex()) = m_decalData.GetData(sourceDecal.GetIndex()); const auto materialAsset = GetMaterialUsedByDecal(sourceDecal); - m_materialToTextureArrayLookupTable.at(materialAsset).m_useCount++; + if (materialAsset.IsValid()) + { + m_materialToTextureArrayLookupTable.at(materialAsset).m_useCount++; + } m_deviceBufferNeedsUpdate = true; } return decal;