From 59a71520ae2965be852e86779df7dc08f3aae3a0 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sun, 10 Mar 2024 00:21:07 -0600 Subject: [PATCH] Fix NRE on trying to update all when there's nothing to update --- GUI/Controls/ManageMods.cs | 10 +++++----- GUI/Model/ModList.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GUI/Controls/ManageMods.cs b/GUI/Controls/ManageMods.cs index 0f66e3aee..d56b0eb01 100644 --- a/GUI/Controls/ManageMods.cs +++ b/GUI/Controls/ManageMods.cs @@ -154,17 +154,17 @@ private void ChangeSetUpdated() var removing = changeIdentifiersOfType(GUIModChangeType.Remove) .Except(changeIdentifiersOfType(GUIModChangeType.Install)) .ToHashSet(); - foreach (var kvp in mainModList.full_list_of_mod_rows) + foreach ((string ident, DataGridViewRow row) in mainModList.full_list_of_mod_rows) { - if (removing.Contains(kvp.Key)) + if (removing.Contains(ident)) { // Set strikeout font for rows being uninstalled - kvp.Value.DefaultCellStyle.Font = uninstallingFont; + row.DefaultCellStyle.Font = uninstallingFont; } - else if (kvp.Value.DefaultCellStyle.Font != null) + else if (row.DefaultCellStyle.Font != null) { // Clear strikeout font for rows not being uninstalled - kvp.Value.DefaultCellStyle.Font = null; + row.DefaultCellStyle.Font = null; } } }); diff --git a/GUI/Model/ModList.cs b/GUI/Model/ModList.cs index 4e8d3aa6a..e404a69c0 100644 --- a/GUI/Model/ModList.cs +++ b/GUI/Model/ModList.cs @@ -43,7 +43,7 @@ public enum GUIModFilter public class ModList { //identifier, row - internal Dictionary full_list_of_mod_rows; + internal Dictionary full_list_of_mod_rows = new Dictionary(); public event Action ModFiltersUpdated; public IReadOnlyCollection Modules { get; private set; } =