Dynamic data models - Don't throw on dynamic child type mismatch

This commit is contained in:
Robert committed 2021-08-06 22:23:17 +02:00
1 parent 0e07dbd631
commit dd592efef2
1 file changed
+6 -1
@@ -258,7 +258,12 @@ namespace Artemis.Core.Modules
internal T? GetDynamicChildValue<T>(string key)
{
if (TryGetDynamicChild(key, out DynamicChild? dynamicChild) && dynamicChild.BaseValue != null)
return (T) dynamicChild.BaseValue;
{
if (dynamicChild.BaseValue is T value)
return value;
return default;
}
return default;
}