diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/MaterialPropertyUtil.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/MaterialPropertyUtil.cpp index 91e3d5c2f0..3ffd8efa6e 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/MaterialPropertyUtil.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/MaterialPropertyUtil.cpp @@ -188,20 +188,26 @@ namespace AtomToolsFramework if (propertyDefinition.m_dataType == AZ::RPI::MaterialPropertyDataType::Image) { AZStd::string imagePath; + AZ::Data::AssetId imageAssetId; if (propertyValue.Is>()) { const auto& imageAsset = propertyValue.GetValue>(); - imagePath = AZ::RPI::AssetUtils::GetSourcePathByAssetId(imageAsset.GetId()); + imageAssetId = imageAsset.GetId(); } if (propertyValue.Is>()) { const auto& image = propertyValue.GetValue>(); - imagePath = image ? AZ::RPI::AssetUtils::GetSourcePathByAssetId(image->GetAssetId()) : ""; + if (image) + { + imageAssetId = image->GetAssetId(); + } } + + imagePath = AZ::RPI::AssetUtils::GetSourcePathByAssetId(imageAssetId); - if (imagePath.empty()) + if (imageAssetId.IsValid() && imagePath.empty()) { AZ_Error("AtomToolsFramework", false, "Image asset could not be found for property: '%s'.", propertyId.GetCStr()); return false;