fix error when loading corrupted translation files
This commit is contained in:
parent
c5b8cd6264
commit
a9fcbc686d
|
@ -1,6 +1,10 @@
|
|||
← [README](README.md)
|
||||
|
||||
# Release notes
|
||||
## Upcoming release
|
||||
* For players:
|
||||
* Fixed crash loading mods if they have corrupted translation files.
|
||||
|
||||
## 3.12.6
|
||||
Released 03 September 2021 for Stardew Valley 1.5.4 or later.
|
||||
|
||||
|
|
|
@ -1891,9 +1891,9 @@ namespace StardewModdingAPI.Framework
|
|||
string locale = Path.GetFileNameWithoutExtension(file.Name.ToLower().Trim());
|
||||
try
|
||||
{
|
||||
if (!jsonHelper.ReadJsonFileIfExists(file.FullName, out IDictionary<string, string> data))
|
||||
if (!jsonHelper.ReadJsonFileIfExists(file.FullName, out IDictionary<string, string> data) || data == null)
|
||||
{
|
||||
errors.Add($"{file.Name} file couldn't be read"); // should never happen, since we're iterating files that exist
|
||||
errors.Add($"{file.Name} file couldn't be read"); // mainly happens when the file is corrupted or empty
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue