From b909f0ac13f547fbbd13a5ec2217cd9960d3dc8f Mon Sep 17 00:00:00 2001 From: William JCM Date: Tue, 13 Dec 2022 21:03:43 +0100 Subject: [PATCH] Profile: fix bug in material saving when array doesn't exist. --- src/Profile/Profile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index 03da3e5..ccc42c8 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -458,6 +458,7 @@ auto Profile::setResource(Containers::StringView container, MaterialID id, Int a if(!mats_prop) { mats_prop = new ArrayProperty; mats_prop->name.emplace(container); + mats_prop->itemType = "StructProperty"; _profile.appendProperty(ArrayProperty::ptr{mats_prop}); } @@ -471,6 +472,9 @@ auto Profile::setResource(Containers::StringView container, MaterialID id, Int a ResourceItemValue* res_prop; if(it == mats_prop->items.end()) { res_prop = new ResourceItemValue; + if(mats_prop->items.isEmpty()) { + res_prop->name.emplace("ResourceMaterial"); + } res_prop->id = id; ResourceItemValue::ptr prop{res_prop}; arrayAppend(mats_prop->items, std::move(prop));