From 68250f7e4e459b85eb655ec945f6ad36b8e254a7 Mon Sep 17 00:00:00 2001 From: Ed Kolis Date: Sat, 3 Feb 2024 00:23:45 -0500 Subject: [PATCH] Fix crash when adding components to a design (#282) --- FrEee/Objects/Technology/MountedComponentTemplate.cs | 3 ++- FrEee/Utility/HashCodeMasher.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/FrEee/Objects/Technology/MountedComponentTemplate.cs b/FrEee/Objects/Technology/MountedComponentTemplate.cs index 0ce1ec71..13f3d68d 100644 --- a/FrEee/Objects/Technology/MountedComponentTemplate.cs +++ b/FrEee/Objects/Technology/MountedComponentTemplate.cs @@ -359,7 +359,8 @@ public override bool Equals(object? obj) public override int GetHashCode() { - return HashCodeMasher.Mash(Container, ComponentTemplate, Mount); + // can't mash the container itself because that would cause a circular dependency on this template + return HashCodeMasher.Mash(Container?.ID, ComponentTemplate, Mount); } /// diff --git a/FrEee/Utility/HashCodeMasher.cs b/FrEee/Utility/HashCodeMasher.cs index 4c629f84..762a4fce 100644 --- a/FrEee/Utility/HashCodeMasher.cs +++ b/FrEee/Utility/HashCodeMasher.cs @@ -8,7 +8,7 @@ namespace FrEee.Utility; /// public static class HashCodeMasher { - public static int Mash(params object[] objs) + public static int Mash(params object?[] objs) { return MashList(objs); }