From 72c8a504c545b7ea53bc790a28a47ffc70738264 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Thu, 24 Nov 2022 23:22:02 +0800 Subject: [PATCH] Fixed crash from adding an element to a list of strings in the script inspector --- SHADE_Managed/src/Editor/Editor.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SHADE_Managed/src/Editor/Editor.cxx b/SHADE_Managed/src/Editor/Editor.cxx index 80c73d4f..8b53db1b 100644 --- a/SHADE_Managed/src/Editor/Editor.cxx +++ b/SHADE_Managed/src/Editor/Editor.cxx @@ -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); }