diff --git a/Nautilus/Handlers/LanguageHandler.cs b/Nautilus/Handlers/LanguageHandler.cs index 2f8fc85d..ef75ff58 100644 --- a/Nautilus/Handlers/LanguageHandler.cs +++ b/Nautilus/Handlers/LanguageHandler.cs @@ -45,7 +45,22 @@ public static void RegisterLocalizationFolder(string languageFolderName = "Local foreach (var file in Directory.GetFiles(path)) { - var content = JsonConvert.DeserializeObject>(File.ReadAllText(file)); + if (Path.GetExtension(file) != ".json") + { + continue; + } + + // I hate this + Dictionary content = null; + try + { + content = JsonConvert.DeserializeObject>(File.ReadAllText(file)); + } + catch (Exception e) + { + InternalLogger.Error($"Exception caught while trying to deserialize localization file at path: '{file}'. Exception: {e}"); + } + if (content is null) { InternalLogger.Warn($"Localization file '{file}' is empty, skipping registration.");