1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:47:24 +08:00

Fix Message equality not passing on equal references

This commit is contained in:
Salman Ahmed 2022-03-08 03:20:20 +03:00
parent 7f47be4680
commit f8e5570e41

View File

@ -59,7 +59,13 @@ namespace osu.Game.Online.Chat
return Id.Value.CompareTo(other.Id.Value);
}
public virtual bool Equals(Message other) => Id.HasValue && Id == other?.Id;
public virtual bool Equals(Message other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Id.HasValue && Id == other?.Id;
}
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
public override int GetHashCode() => Id.GetHashCode();