diff --git a/project/SPT.Custom/Patches/SaveRegistryToSptFolderPatches.cs b/project/SPT.Custom/Patches/SaveRegistryToSptFolderPatches.cs index 88cf3c3..daca92d 100644 --- a/project/SPT.Custom/Patches/SaveRegistryToSptFolderPatches.cs +++ b/project/SPT.Custom/Patches/SaveRegistryToSptFolderPatches.cs @@ -4,6 +4,7 @@ using SPT.Reflection.Patching; using System; using System.IO; using System.Reflection; +using EFT.UI; using UnityEngine; namespace SPT.Custom.Patches @@ -45,11 +46,21 @@ namespace SPT.Custom.Patches Directory.CreateDirectory(_sptRegistryPath); } - // Load the existing registry if found - if (File.Exists(_registryFilePath)) + + if (!File.Exists(_registryFilePath)) { + return; + } + + try + { + // Load existing registry _sptRegistry = JObject.Parse(File.ReadAllText(_registryFilePath)); } + catch (Exception e) + { + ConsoleScreen.LogError($"Unable to parse registry file, defaulting to empty: {e.Message}"); + } } public class PatchPlayerPrefsSetInt : ModulePatch