Skip to content

Commit

Permalink
remove duplicate dictionary lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jun 12, 2024
1 parent 98fd6c4 commit 24d28e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Chickensoft.Serialization/src/SerializableBlackboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 24d28e6

Please sign in to comment.