summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-04-11 15:41:32 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-04-11 15:41:32 -0400
commitfa335f80beee17f17ecedcfa7bcb6f9967a39776 (patch)
treeeb09d24d7fa28ba6adc844d5cb5cc456f74e5397
parent83969b57890ea1633ddc14ec58282d0c61c36637 (diff)
downloadSMAPI-fa335f80beee17f17ecedcfa7bcb6f9967a39776.tar.gz
SMAPI-fa335f80beee17f17ecedcfa7bcb6f9967a39776.tar.bz2
SMAPI-fa335f80beee17f17ecedcfa7bcb6f9967a39776.zip
fix crash when player has duplicate item references
-rw-r--r--docs/release-notes.md3
-rw-r--r--src/SMAPI/Framework/SGame.cs2
2 files changed, 3 insertions, 2 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index c65d6e0d..66d911b7 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -4,7 +4,6 @@
* For players:
* Added support for Stardew Valley 1.3+; no longer compatible with earlier versions.
* Added `Context.IsMultiplayer` and `Context.IsMainPlayer` flags.
- * Fixed SMAPI update alerts linking to the GitHub repository instead of [smapi.io](https://smapi.io).
* Fixed SMAPI update checks not showing newer beta versions when using a beta version.
* For modders:
@@ -21,6 +20,8 @@
## 2.5.5
* For players:
* Fixed mods not being loaded if an optional dependency is installed but skipped.
+ * Fixed rare crash when the game duplicates an item.
+ * Fixed SMAPI update alerts linking to the GitHub repository instead of [smapi.io](https://smapi.io).
* For the [log parser][]:
* Tweaked UI.
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index ae702711..9af02dd4 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -569,7 +569,7 @@ namespace StardewModdingAPI.Framework
this.PreviousForagingLevel = Game1.player.foragingLevel;
this.PreviousMiningLevel = Game1.player.miningLevel;
this.PreviousLuckLevel = Game1.player.luckLevel;
- this.PreviousItems = Game1.player.items.Where(n => n != null).ToDictionary(n => n, n => n.Stack);
+ this.PreviousItems = Game1.player.items.Where(n => n != null).Distinct().ToDictionary(n => n, n => n.Stack);
this.PreviousLocationObjects = this.GetHash(Game1.currentLocation.objects);
this.PreviousTime = Game1.timeOfDay;
this.PreviousMineLevel = Game1.mine?.mineLevel ?? 0;