summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-03-23 22:41:15 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-03-23 22:41:15 -0400
commit5126d56b3992acd3193aaae35f178bb5e9da1cae (patch)
treeda02a80055aef9df253f0c4a1679884789562f87
parentfad47ff74f6d03652951230eb1c394b896578c48 (diff)
downloadSMAPI-5126d56b3992acd3193aaae35f178bb5e9da1cae.tar.gz
SMAPI-5126d56b3992acd3193aaae35f178bb5e9da1cae.tar.bz2
SMAPI-5126d56b3992acd3193aaae35f178bb5e9da1cae.zip
fix error when a mod removes an asset editor/loader (#460)
-rw-r--r--docs/release-notes.md3
-rw-r--r--src/SMAPI/Program.cs4
2 files changed, 4 insertions, 3 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index c40e41be..33e66a14 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -18,7 +18,8 @@
## 2.5.4
* For players:
* Fixed tree textures not updated when changed through the content API.
- * Fixed display bugs on Linux/Mac when mods overlay images through the content API.
+ * Fixed visual bug on Linux/Mac when mods overlay images through the content API.
+ * Fixed error when a mod removes an asset editor/loader.
* For the [log parser][]:
* Fixed error when log text contains certain tokens.
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs
index 8c1ea238..1b8cb2ba 100644
--- a/src/SMAPI/Program.cs
+++ b/src/SMAPI/Program.cs
@@ -953,7 +953,7 @@ namespace StardewModdingAPI
{
helper.ObservableAssetEditors.CollectionChanged += (sender, e) =>
{
- if (e.NewItems.Count > 0)
+ if (e.NewItems?.Count > 0)
{
this.Monitor.Log("Invalidating cache entries for new asset editors...", LogLevel.Trace);
this.ContentCore.InvalidateCacheFor(e.NewItems.Cast<IAssetEditor>().ToArray(), new IAssetLoader[0]);
@@ -961,7 +961,7 @@ namespace StardewModdingAPI
};
helper.ObservableAssetLoaders.CollectionChanged += (sender, e) =>
{
- if (e.NewItems.Count > 0)
+ if (e.NewItems?.Count > 0)
{
this.Monitor.Log("Invalidating cache entries for new asset loaders...", LogLevel.Trace);
this.ContentCore.InvalidateCacheFor(new IAssetEditor[0], e.NewItems.Cast<IAssetLoader>().ToArray());