Commit 0091f010996a94df97b90f5353bf39ca0e851197

Authored by Mumfrey
1 parent 755c90be

fix locals indexing derp in HandlerList

java/common/com/mumfrey/liteloader/core/PacketEvents.java
... ... @@ -124,8 +124,16 @@ public abstract class PacketEvents implements InterfaceProvider
124 124 return;
125 125 }
126 126  
127   - if (this.packetHandlers[packetId].all().handlePacket(netHandler, e.getSource()))
  127 + try
128 128 {
  129 + if (this.packetHandlers[packetId].all().handlePacket(netHandler, e.getSource()))
  130 + {
  131 + return;
  132 + }
  133 + }
  134 + catch (Throwable ex)
  135 + {
  136 + ex.printStackTrace();
129 137 return;
130 138 }
131 139  
... ...
java/common/com/mumfrey/liteloader/core/event/HandlerList.java
... ... @@ -910,8 +910,9 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T
910 910  
911 911 method.instructions.add(new InsnNode(returnType.getOpcode(Opcodes.IRETURN)));
912 912  
913   - method.maxLocals = args.length + 1;
914   - method.maxStack = args.length + 1;
  913 + int argsSize = ByteCodeUtilities.getArgsSize(args);
  914 + method.maxLocals = argsSize + 1;
  915 + method.maxStack = argsSize + 1;
915 916 }
916 917  
917 918 /**
... ... @@ -924,7 +925,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T
924 925 boolean isOrOperation = this.logicOp.isOr();
925 926 boolean breakOnMatch = this.logicOp.breakOnMatch();
926 927 int initialValue = isOrOperation && (!this.logicOp.assumeTrue() || this.size > 0) ? Opcodes.ICONST_0 : Opcodes.ICONST_1;
927   - int localIndex = ByteCodeUtilities.getArgsSize(args);
  928 + int localIndex = ByteCodeUtilities.getArgsSize(args) + 1;
928 929  
929 930 method.instructions.add(new InsnNode(initialValue));
930 931 method.instructions.add(new VarInsnNode(Opcodes.ISTORE, localIndex));
... ... @@ -946,8 +947,8 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T
946 947 method.instructions.add(new VarInsnNode(Opcodes.ILOAD, localIndex));
947 948 method.instructions.add(new InsnNode(Opcodes.IRETURN));
948 949  
949   - method.maxLocals = args.length + 2;
950   - method.maxStack = args.length + 1;
  950 + method.maxLocals = localIndex + 2;
  951 + method.maxStack = localIndex + 1;
951 952 }
952 953  
953 954 /**
... ...