diff --git a/SabreTools.Helper/Objects/Dat/DatFile.cs b/SabreTools.Helper/Objects/Dat/DatFile.cs index de07a682..f7b97e2e 100644 --- a/SabreTools.Helper/Objects/Dat/DatFile.cs +++ b/SabreTools.Helper/Objects/Dat/DatFile.cs @@ -3005,6 +3005,20 @@ namespace SabreTools.Helper foreach (string key in keys) { + // If the dictionary somehow doesn't have the key in question, continue + if (!sortable.ContainsKey(key)) + { + logger.Warning("SortedDictionary does not contain key: " + key); + continue; + } + + // If we somehow have a null list, just skip it + if (sortable[key] == null) + { + logger.Warning("Blank list found for key: " + key); + continue; + } + List roms = sortable[key]; for (int index = 0; index < roms.Count; index++)