Fix WiredEffectTriggerStacks NPE.

This commit is contained in:
KrewsOrg 2020-04-23 16:06:17 +01:00
parent f261e8c10c
commit fc6dd9790d

View File

@ -102,7 +102,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
@Override @Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
if (stuff != null && stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks) { if (stuff == null && stuff.length >= 1 && stuff[stuff.length - 1] instanceof WiredEffectTriggerStacks) {
return false; return false;
} }
@ -126,14 +126,14 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
} }
} }
} }
Object[] newStuff = new Object[stuff.length + 1];
System.arraycopy(stuff, 0, newStuff, 0, stuff.length);
newStuff[newStuff.length - 1] = this;
WiredHandler.executeEffectsAtTiles(usedTiles, roomUnit, room, stuff);
Object[] newStuff = new Object[stuff.length + 1]; return true;
System.arraycopy(stuff, 0, newStuff, 0, stuff.length); }
newStuff[newStuff.length - 1] = this;
WiredHandler.executeEffectsAtTiles(usedTiles, roomUnit, room, stuff);
return true;
}
@Override @Override
public String getWiredData() { public String getWiredData() {