From 61454e1ae2f2ce18550bbb337719e39a3058884f Mon Sep 17 00:00:00 2001 From: MoshiMoshi0 <902882+MoshiMoshi0@users.noreply.github.com> Date: Thu, 26 Sep 2019 22:41:14 +0200 Subject: [PATCH] Fix StackOverflowException when comparing Identifiers (#136) --- LibreHardwareMonitorLib/Hardware/Identifier.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LibreHardwareMonitorLib/Hardware/Identifier.cs b/LibreHardwareMonitorLib/Hardware/Identifier.cs index 27bc1ae..a86f1eb 100644 --- a/LibreHardwareMonitorLib/Hardware/Identifier.cs +++ b/LibreHardwareMonitorLib/Hardware/Identifier.cs @@ -86,12 +86,11 @@ namespace LibreHardwareMonitor.Hardware } public static bool operator ==(Identifier id1, Identifier id2) - { - if (id1 == null && id2 == null) + { + if (ReferenceEquals(id1, null) && ReferenceEquals(id2, null)) return true; - - return id1 != null && id1.Equals(id2); + return !ReferenceEquals(id1, null) && id1.Equals(id2); } public static bool operator !=(Identifier id1, Identifier id2)