mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Null checks, de-parallelize
This commit is contained in:
@@ -280,7 +280,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
// First do the initial sort of all of the roms inplace
|
// First do the initial sort of all of the roms inplace
|
||||||
List<string> oldkeys = Keys;
|
List<string> oldkeys = Keys;
|
||||||
Parallel.For(0, oldkeys.Count, Globals.ParallelOptions, k =>
|
for (int k = 0; k < oldkeys.Count; k++)
|
||||||
{
|
{
|
||||||
string key = oldkeys[k];
|
string key = oldkeys[k];
|
||||||
|
|
||||||
@@ -291,6 +291,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
for (int i = 0; i < items.Count; i++)
|
for (int i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
DatItem item = items[i];
|
DatItem item = items[i];
|
||||||
|
if (item == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
// We want to get the key most appropriate for the given sorting type
|
// We want to get the key most appropriate for the given sorting type
|
||||||
string newkey = item.GetKey(bucketBy, lower, norename);
|
string newkey = item.GetKey(bucketBy, lower, norename);
|
||||||
@@ -303,7 +305,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
i--; // This make sure that the pointer stays on the correct since one was removed
|
i--; // This make sure that the pointer stays on the correct since one was removed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
// If the key is now empty, remove it
|
||||||
|
if (this[key].Count == 0)
|
||||||
|
Remove(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
// If the merge type isn't the same, we want to merge the dictionary accordingly
|
||||||
|
|||||||
@@ -784,6 +784,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (string key in datFile.Keys)
|
foreach (string key in datFile.Keys)
|
||||||
{
|
{
|
||||||
List<DatItem> items = datFile[key];
|
List<DatItem> items = datFile[key];
|
||||||
|
if (items == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
List<DatItem> newitems = items.Where(i => i.ItemType != ItemType.Blank).ToList();
|
List<DatItem> newitems = items.Where(i => i.ItemType != ItemType.Blank).ToList();
|
||||||
|
|
||||||
datFile.Remove(key);
|
datFile.Remove(key);
|
||||||
@@ -890,6 +893,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (string key in outDat.Keys)
|
foreach (string key in outDat.Keys)
|
||||||
{
|
{
|
||||||
List<DatItem> items = outDat[key];
|
List<DatItem> items = outDat[key];
|
||||||
|
if (items == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
List<DatItem> newitems = items.Where(i => i.ItemType != ItemType.Blank).ToList();
|
List<DatItem> newitems = items.Where(i => i.ItemType != ItemType.Blank).ToList();
|
||||||
|
|
||||||
outDat.Remove(key);
|
outDat.Remove(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user