If the item doesn't exist anymore, remove it from storage to avoid crashes

This commit is contained in:
Raoul Van den Berge
2016-04-03 16:23:14 +02:00
parent 78dddd4807
commit 789a46f39e

View File

@@ -186,17 +186,22 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
ItemGroup group = itemGroups.get(i); ItemGroup group = itemGroups.get(i);
for (int j = i + 1; j < itemGroups.size(); ++j) { // If the item doesn't exist anymore, remove it from storage to avoid crashes
if (markedIndexes.contains(j)) { if (group.getType() == null) {
continue; markedIndexes.add(i);
} } else {
for (int j = i + 1; j < itemGroups.size(); ++j) {
if (markedIndexes.contains(j)) {
continue;
}
ItemGroup otherGroup = itemGroups.get(j); ItemGroup otherGroup = itemGroups.get(j);
if (group.compareNoQuantity(otherGroup)) { if (group.compareNoQuantity(otherGroup)) {
group.setQuantity(group.getQuantity() + otherGroup.getQuantity()); group.setQuantity(group.getQuantity() + otherGroup.getQuantity());
markedIndexes.add(j); markedIndexes.add(j);
}
} }
} }
} }