mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
ScriptCore: Fixed error when deserializing list of strings
This commit is contained in:
@@ -446,7 +446,7 @@ public class DeserializationObject
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
object? elementValue = ActivatorExtension.CreateInstanceSafe(elementType);
|
||||
object? elementValue = NeedsInstance(elementType) ? ActivatorExtension.CreateInstanceSafe(elementType) : null;
|
||||
|
||||
object? newValue = deserializedObject.DeserializeField(elementValue, elementType, $"{i}");
|
||||
|
||||
@@ -464,6 +464,19 @@ public class DeserializationObject
|
||||
return deserializedObject._instance;
|
||||
}
|
||||
|
||||
private bool NeedsInstance(Type type)
|
||||
{
|
||||
if (type.IsClass)
|
||||
{
|
||||
if (type == typeof(string))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public object DeserializeEnum(string fieldName, Type enumType)
|
||||
{
|
||||
if (GetFieldValue(fieldName, SerializationType.Enum) is not string valueName)
|
||||
|
||||
Reference in New Issue
Block a user