diff --git a/IPA.Loader/Config/ConfigRuntime.cs b/IPA.Loader/Config/ConfigRuntime.cs index 28e510a0..8cd420fc 100644 --- a/IPA.Loader/Config/ConfigRuntime.cs +++ b/IPA.Loader/Config/ConfigRuntime.cs @@ -27,10 +27,8 @@ namespace IPA.Config private static readonly ConcurrentBag configs = new(); private static readonly AutoResetEvent configsChangedWatcher = new(false); - private static readonly ConcurrentDictionary watchers - = new ConcurrentDictionary(new DirInfoEqComparer()); - private static readonly ConcurrentDictionary> watcherTrackConfigs - = new ConcurrentDictionary>(); + private static readonly ConcurrentDictionary watchers = new(new DirInfoEqComparer()); + private static readonly ConcurrentDictionary> watcherTrackConfigs = new(); private static BlockingCollection requiresSave = new(); private static SingleThreadTaskScheduler loadScheduler; private static TaskFactory loadFactory; @@ -82,13 +80,14 @@ namespace IPA.Config loadScheduler.Join(); // we can wait for the loads to finish saveThread.Abort(); // eww, but i don't like any of the other potential solutions + legacySaveThread.Abort(); SaveAll(); requiresSave.Dispose(); requiresSave = null; } - catch + catch { } } @@ -237,7 +236,7 @@ namespace IPA.Config { try { - Save(configs.First((c) => ReferenceEquals(c.Store.WriteSyncObject, item.WriteSyncObject))); + Save(configs.First((c) => c.Store != null && ReferenceEquals(c.Store.WriteSyncObject, item.WriteSyncObject))); } catch (ThreadAbortException) { @@ -263,7 +262,7 @@ namespace IPA.Config { while (true) { - var configArr = configs.Where(c => c.Store != null).Where(c => c.Store.SyncObject != null).ToArray(); + var configArr = configs.Where(c => c.Store?.SyncObject != null).ToArray(); int index = -1; try { diff --git a/IPA/Program.cs b/IPA/Program.cs index 375a15cf..263019e5 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -334,9 +334,9 @@ namespace IPA LineBack(); ClearLine(); } - catch (Exception ex) + catch (IOException) { - // Might throw IOException due to an invalid handle when accessing IsConsole from a MSBuild task. + // Might throw due to an invalid handle when accessing IsConsole from a MSBuild task. } Console.WriteLine(@"Copying {0}", targetFile.FullName);