From 99e4a4a1ccf5dcbe0e4b1af7591e229a0eeae447 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 21 Sep 2018 18:25:33 -0400 Subject: fix crash when mods add an invalid location with no name --- src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/SMAPI/Framework') diff --git a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs index d9090c08..5a259663 100644 --- a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs +++ b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using StardewModdingAPI.Framework.StateTracking.Comparers; using StardewModdingAPI.Framework.StateTracking.FieldWatchers; using StardewValley; using StardewValley.Buildings; @@ -18,10 +20,10 @@ namespace StardewModdingAPI.Framework.StateTracking private readonly ICollectionWatcher LocationListWatcher; /// A lookup of the tracked locations. - private IDictionary LocationDict { get; } = new Dictionary(); + private IDictionary LocationDict { get; } = new Dictionary(new ObjectReferenceComparer()); /// A lookup of registered buildings and their indoor location. - private readonly IDictionary BuildingIndoors = new Dictionary(); + private readonly IDictionary BuildingIndoors = new Dictionary(new ObjectReferenceComparer()); /********* @@ -37,10 +39,10 @@ namespace StardewModdingAPI.Framework.StateTracking public IEnumerable Locations => this.LocationDict.Values; /// The locations removed since the last update. - public ICollection Added { get; } = new HashSet(); + public ICollection Added { get; } = new HashSet(new ObjectReferenceComparer()); /// The locations added since the last update. - public ICollection Removed { get; } = new HashSet(); + public ICollection Removed { get; } = new HashSet(new ObjectReferenceComparer()); /********* -- cgit