Skip to content

Commit

Permalink
Always return value when using TryGetValue. If Null, return empty rea…
Browse files Browse the repository at this point in the history
…donly collection instead of null.
  • Loading branch information
cwinland committed May 28, 2024
1 parent 8a8adaa commit 9032e24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FastMoq.Core/Models/ConstructorHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public bool Contains(Type key)
public bool TryGetValue(Type key, out ReadOnlyCollection<IHistoryModel> value)
{
var result = constructorHistory.TryGetValue(key, out var value2);
value = value2?.AsReadOnly();
value = value2?.AsReadOnly() ?? new List<IHistoryModel>().AsReadOnly();
return result;
}

Expand Down

0 comments on commit 9032e24

Please sign in to comment.