Skip to content

Commit d4eca3c

Browse files
authored
Fix findFirstInstructionBefore ignoring the start index (#50)
1 parent 523e3d9 commit d4eca3c

File tree

1 file changed

+1
-1
lines changed
  • src/main/java/net/minecraftforge/coremod/api

1 file changed

+1
-1
lines changed

src/main/java/net/minecraftforge/coremod/api/ASMAPI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static AbstractInsnNode findFirstInstructionAfter(MethodNode method, int
157157
* @return the found instruction node or null if none matched before the given startIndex
158158
*/
159159
public static AbstractInsnNode findFirstInstructionBefore(MethodNode method, int opCode, int startIndex) {
160-
for (int i = Math.max(method.instructions.size() - 1, startIndex); i >= 0; i--) {
160+
for (int i = Math.min(method.instructions.size() - 1, startIndex); i >= 0; i--) {
161161
AbstractInsnNode ain = method.instructions.get(i);
162162
if (ain.getOpcode() == opCode) {
163163
return ain;

0 commit comments

Comments
 (0)