Fixed some storage bus related crashes.

Fixed an issue where the storage might access inventories that have been removed from the world.
Fixed an issue caused by refactoring.
This commit is contained in:
AlgorithmX2
2014-07-23 23:20:16 -05:00
parent 42b6647ec3
commit 2b6cca0267
5 changed files with 22 additions and 14 deletions
+6 -6
View File
@@ -20,13 +20,11 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap();
IMEMonitor<T> monitor;
StorageChannel channel;
public BaseActionSource changeSource;
public MEMonitorPassthu(IMEInventory<T> i, StorageChannel channel ) {
super( i );
this.channel = channel;
public MEMonitorPassthu(IMEInventory<T> i, StorageChannel channel) {
super( i, channel );
if ( i instanceof IMEMonitor )
monitor = (IMEMonitor<T>) i;
}
@@ -38,13 +36,15 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
monitor.removeListener( this );
monitor = null;
IItemList<T> before = getInternal() == null ? channel.createList() : getInternal().getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
IItemList<T> before = getInternal() == null ? channel.createList() : getInternal()
.getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
super.setInternal( i );
if ( i instanceof IMEMonitor )
monitor = (IMEMonitor<T>) i;
IItemList<T> after = getInternal() == null ? channel.createList() : getInternal().getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
IItemList<T> after = getInternal() == null ? channel.createList() : getInternal()
.getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
if ( monitor != null )
monitor.addListener( this, monitor );