From db183441cdc85a2972828e9d0cca6060e6d32186 Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Thu, 11 Jan 2024 20:09:12 +0300 Subject: [PATCH] Make a `MemberComparer` class more reliable (#557) --- ClearScript/Util/MemberComparer.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ClearScript/Util/MemberComparer.cs b/ClearScript/Util/MemberComparer.cs index 7d9372a80..bd2f1cb94 100644 --- a/ClearScript/Util/MemberComparer.cs +++ b/ClearScript/Util/MemberComparer.cs @@ -16,6 +16,15 @@ private MemberComparer() public override bool Equals(T x, T y) { + if ((x == null) && (y == null)) + { + return true; + } + else if ((x == null) || (y == null)) + { + return false; + } + try { return (x.Module == y.Module) && (x.MetadataToken == y.MetadataToken);