fix error when a location doesn't have a map asset key

This commit is contained in:
Jesse Plamondon-Willard 2018-12-07 16:29:06 -05:00
parent 8ff4111027
commit 085b1be28c
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
2 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
## 2.9.1 ## 2.9.1
* For players: * For players:
* Fixed crash in SMAPI 2.9 when constructing certain buildings. * Fixed crash in SMAPI 2.9 when constructing certain buildings.
* Fixed error when a map asset is reloaded in rare cases.
## 2.9 ## 2.9
* For players: * For players:

View File

@ -92,7 +92,7 @@ namespace StardewModdingAPI.Metadata
bool anyChanged = false; bool anyChanged = false;
foreach (GameLocation location in this.GetLocations()) foreach (GameLocation location in this.GetLocations())
{ {
if (this.GetNormalisedPath(location.mapPath.Value) == key) if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.GetNormalisedPath(location.mapPath.Value) == key)
{ {
this.Reflection.GetMethod(location, "reloadMap").Invoke(); this.Reflection.GetMethod(location, "reloadMap").Invoke();
this.Reflection.GetMethod(location, "updateWarps").Invoke(); this.Reflection.GetMethod(location, "updateWarps").Invoke();