From 51ec99d8ddc56cde88535ed0da7bef2275b87d6b Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 22 Aug 2023 15:47:50 +0700 Subject: [PATCH] Actually account for case when both references refer to null --- .../dbotthepony/mc/otm/core/collect/ReferenceHashStrategy.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/collect/ReferenceHashStrategy.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/collect/ReferenceHashStrategy.kt index eb3e61200..a8ed01173 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/collect/ReferenceHashStrategy.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/collect/ReferenceHashStrategy.kt @@ -9,8 +9,9 @@ object ReferenceHashStrategy : Hash.Strategy { if (a == null || b == null) return false if (a is Reference<*>) { - if (b is Reference<*>) return a.get() != null && a.get() == b.get() - return a.get() == b + val ref = a.get() + if (b is Reference<*>) return ref != null && ref == b.get() + return ref == b } else if (b is Reference<*>) { return b.get() == a } else {