Skip to content

Commit

Permalink
Use AsNonNull and add comment for explaination
Browse files Browse the repository at this point in the history
  • Loading branch information
huoyaoyuan committed Jul 7, 2022
1 parent b5becda commit 3af9254
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions osu.Framework/Bindables/Bindable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,8 @@ void ISerializableBindable.SerializeTo(JsonWriter writer, JsonSerializer seriali
void ISerializableBindable.DeserializeFrom(JsonReader reader, JsonSerializer serializer)
{
// Deserialize returns null for json literal "null".
var result = serializer.Deserialize<T>(reader);
Debug.Assert(result != null);
Value = result;
// The nullability of type parameter T is unavailable here, so we can't do any validation.
Value = serializer.Deserialize<T>(reader).AsNonNull();
}

private LeasedBindable<T>? leasedBindable;
Expand Down

0 comments on commit 3af9254

Please sign in to comment.