fixed issue with setter not handling null values exposed by failing unit test

This commit is contained in:
Chris Adamson
2025-05-29 14:01:16 -05:00
parent ab1886f3ab
commit 5db0fd575b
2 changed files with 10 additions and 2 deletions
@@ -67,7 +67,7 @@ public record TemplateItem
}
set
{
_type = string.Intern(value);
_type = value != null ? string.Intern(value) : null;
}
}
@@ -21,7 +21,15 @@ public class ReflectionsCloner(ISptLogger<ReflectionsCloner> logger) : ICloner
public T? Clone<T>(T? obj)
{
return (T?) Clone(obj, typeof(T)).Result;
try
{
return (T?) Clone(obj, typeof(T)).Result;
}
catch (Exception e)
{
logger.Error("cloning error:", e);
return default;
}
}
public async Task<object?> Clone(object? obj, Type objectType)