[DatFile] Add a lock and some comments

This commit is contained in:
Matt Nadareski
2017-03-01 20:00:21 -08:00
parent 7a26f5a6fe
commit e4b6e8307d

View File

@@ -56,6 +56,7 @@ namespace SabreTools.Helper.Dats
{ {
string newkey = ""; string newkey = "";
// We want to get the key most appropriate for the given sorting type
switch (bucketBy) switch (bucketBy)
{ {
case SortedBy.CRC: case SortedBy.CRC:
@@ -113,11 +114,15 @@ namespace SabreTools.Helper.Dats
break; break;
} }
if (!sortable.ContainsKey(newkey)) // Add the DatItem to the temp dictionary
lock (sortable)
{ {
sortable.Add(newkey, new List<DatItem>()); if (!sortable.ContainsKey(newkey))
{
sortable.Add(newkey, new List<DatItem>());
}
sortable[newkey].Add(rom);
} }
sortable[newkey].Add(rom);
} }
}); });