diff --git a/Chickensoft.Serialization/src/SerializableBlackboard.cs b/Chickensoft.Serialization/src/SerializableBlackboard.cs index 88b106f..bd0b4f5 100644 --- a/Chickensoft.Serialization/src/SerializableBlackboard.cs +++ b/Chickensoft.Serialization/src/SerializableBlackboard.cs @@ -133,8 +133,8 @@ protected override object GetBlackboardData(Type type) { // If it is a persisted type that isn't on the blackboard yet, we can // create an instance of the data and add it. - if (_saveTypes.ContainsKey(type)) { - data = _saveTypes[type](); + if (_saveTypes.TryGetValue(type, out var saveType)) { + data = saveType(); _blackboard[type] = data; return data; }