From 23b93ed406d9219822a6712ede50b7e2c5e15bea Mon Sep 17 00:00:00 2001 From: MycroftJr <33704388+mycroftjr@users.noreply.github.com> Date: Wed, 27 Jul 2022 21:48:38 -0700 Subject: [PATCH 1/2] do not continue if game location was not found --- PFR/PersonalEffectsRedux/Spot.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PFR/PersonalEffectsRedux/Spot.cs b/PFR/PersonalEffectsRedux/Spot.cs index 1c76a62..37a35ec 100644 --- a/PFR/PersonalEffectsRedux/Spot.cs +++ b/PFR/PersonalEffectsRedux/Spot.cs @@ -38,6 +38,7 @@ private static void Roll(object sender, EventArgs e) //despawn old items var l = Game1.getLocationFromName(ss.Location); + if (!l) continue; var pos = new Vector2(ss.X, ss.Y); if (l.objects.ContainsKey(pos)) { @@ -192,4 +193,4 @@ private Spot(string npc, string loc, string locType, int x, int y, int chance, s ForSVE = forSVE; } } -} \ No newline at end of file +} From 53493d13939fcf7d8f91788e5edd2c788170d44e Mon Sep 17 00:00:00 2001 From: MycroftJr <33704388+mycroftjr@users.noreply.github.com> Date: Wed, 27 Jul 2022 21:52:15 -0700 Subject: [PATCH 2/2] improve fix --- PFR/PersonalEffectsRedux/Spot.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PFR/PersonalEffectsRedux/Spot.cs b/PFR/PersonalEffectsRedux/Spot.cs index 37a35ec..eda52ef 100644 --- a/PFR/PersonalEffectsRedux/Spot.cs +++ b/PFR/PersonalEffectsRedux/Spot.cs @@ -38,7 +38,11 @@ private static void Roll(object sender, EventArgs e) //despawn old items var l = Game1.getLocationFromName(ss.Location); - if (!l) continue; + if (l == null) + { + Modworks.Log.Warn($"Location {ss.Location} did not resolve to any known GameLocation"); + continue; + } var pos = new Vector2(ss.X, ss.Y); if (l.objects.ContainsKey(pos)) {