Avoid unnecessary rereads in RemoveItemsFromRomOfChild

This commit is contained in:
Matt Nadareski
2025-05-11 21:19:28 -04:00
parent a47652bab9
commit a8b71d6dae

View File

@@ -1223,14 +1223,13 @@ namespace SabreTools.DatFiles
{ {
while (true) while (true)
{ {
// Reset the items list each time an item is removed so the index is accurate
items = GetItemsForBucket(bucket);
// Find the next index that matches the item // Find the next index that matches the item
int index = items.FindIndex(i => i.Equals(item)); int index = items.FindIndex(i => i.Equals(item));
if (index < 0) if (index < 0)
break; break;
// Remove the item from the local and internal lists
items.RemoveAt(index);
RemoveItem(bucket, items[index], index); RemoveItem(bucket, items[index], index);
} }
} }