From 71f387168c7eda5b06d513bd7a3815b62ed4fb6d Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 9 Dec 2019 21:41:19 -0600 Subject: [PATCH] Improved robustness of SelfConfig --- IPA.Loader/Config/SelfConfig.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 5e9a7cf1..55c78fa0 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -65,12 +65,12 @@ namespace IPA.Config { public bool AutoUpdate = true; // LINE: ignore 2 - public static bool AutoUpdate_ => Instance.Updates.AutoUpdate + public static bool AutoUpdate_ => (Instance?.Updates?.AutoUpdate ?? true) && CommandLineValues.Updates.AutoUpdate; public bool AutoCheckUpdates = true; // LINE: ignore 2 - public static bool AutoCheckUpdates_ => Instance.Updates.AutoCheckUpdates + public static bool AutoCheckUpdates_ => (Instance?.Updates?.AutoCheckUpdates ?? true) && CommandLineValues.Updates.AutoCheckUpdates; } @@ -80,35 +80,35 @@ namespace IPA.Config { public bool ShowCallSource = false; // LINE: ignore 2 - public static bool ShowCallSource_ => Instance.Debug.ShowCallSource + public static bool ShowCallSource_ => (Instance?.Debug?.ShowCallSource ?? false) || CommandLineValues.Debug.ShowCallSource; public bool ShowDebug = false; // LINE: ignore 2 - public static bool ShowDebug_ => Instance.Debug.ShowDebug + public static bool ShowDebug_ => (Instance?.Debug?.ShowDebug ?? false) || CommandLineValues.Debug.ShowDebug; // This option only takes effect after a full game restart, unless new logs are created again public bool CondenseModLogs = false; // LINE: ignore 2 - public static bool CondenseModLogs_ => Instance?.Debug.CondenseModLogs ?? false + public static bool CondenseModLogs_ => (Instance?.Debug?.CondenseModLogs ?? false) || CommandLineValues.Debug.CondenseModLogs; public bool ShowHandledErrorStackTraces = false; // LINE: ignore - public static bool ShowHandledErrorStackTraces_ => Instance.Debug.ShowHandledErrorStackTraces; + public static bool ShowHandledErrorStackTraces_ => Instance?.Debug?.ShowHandledErrorStackTraces ?? false; public bool HideMessagesForPerformance = true; // LINE: ignore - public static bool HideMessagesForPerformance_ => Instance.Debug.HideMessagesForPerformance; + public static bool HideMessagesForPerformance_ => Instance?.Debug?.HideMessagesForPerformance ?? true; public int HideLogThreshold = 512; // LINE: ignore - public static int HideLogThreshold_ => Instance.Debug.HideLogThreshold; + public static int HideLogThreshold_ => Instance?.Debug?.HideLogThreshold ?? 512; public bool ShowTrace = false; // LINE: ignore 2 - public static bool ShowTrace_ => Instance.Debug.ShowTrace + public static bool ShowTrace_ => (Instance?.Debug?.ShowTrace ?? false) || CommandLineValues.Debug.ShowTrace; } @@ -116,12 +116,12 @@ namespace IPA.Config public bool YeetMods = true; // LINE: ignore 2 - public static bool YeetMods_ => Instance.YeetMods + public static bool YeetMods_ => (Instance?.YeetMods ?? true) && CommandLineValues.YeetMods; [JsonProperty(Required = Required.Default)] public string LastGameVersion = null; // LINE: ignore - public static string LastGameVersion_ => Instance.LastGameVersion; + public static string LastGameVersion_ => Instance?.LastGameVersion; } } \ No newline at end of file