Fixed crash from adding an element to a list of strings in the script inspector

This commit is contained in:
Kah Wei 2022-11-24 23:22:02 +08:00
parent 7c58c9a23d
commit 72c8a504c5
1 changed files with 10 additions and 1 deletions

View File

@ -200,7 +200,16 @@ namespace SHADE
{
if (SHEditorUI::Button("Add Item"))
{
System::Object^ obj = System::Activator::CreateInstance(listType);
System::Object^ obj;
if (listType == System::String::typeid)
{
// Special case for string
obj = gcnew System::String("");
}
else
{
obj = System::Activator::CreateInstance(listType);
}
iList->Add(obj);
registerUndoListAddAction(listType, iList, iList->Count - 1, obj);
}