From a105664fd3727daecf3c186ccfa28b29b098cd2f Mon Sep 17 00:00:00 2001 From: Raoul Van den Berge Date: Fri, 20 May 2016 21:53:11 +0200 Subject: [PATCH] Fix external storage bug --- src/main/java/refinedstorage/tile/TileController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/refinedstorage/tile/TileController.java b/src/main/java/refinedstorage/tile/TileController.java index 035c42355..c4b779772 100755 --- a/src/main/java/refinedstorage/tile/TileController.java +++ b/src/main/java/refinedstorage/tile/TileController.java @@ -353,8 +353,9 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr ItemGroup otherGroup = itemGroups.get(j); if (group.compareNoQuantity(otherGroup)) { - // We copy here so we don't modify the quantity of the item group IStorage uses - itemGroups.set(i, group.copy(group.getQuantity() + otherGroup.getQuantity())); + // We copy here so we don't modify the quantity of the item group IStorage uses. + // We re-get the itemgroup with .get(i) because the group may change from a previous iteration in this for loop. + itemGroups.set(i, itemGroups.get(i).copy(itemGroups.get(i).getQuantity() + otherGroup.getQuantity())); combinedGroups.add(otherGroup); combinedGroupsIndices.add(j);