Skip to content

Commit

Permalink
Fix findFirstInstructionBefore ignoring the start index (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathing authored Oct 11, 2024
1 parent 523e3d9 commit d4eca3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/net/minecraftforge/coremod/api/ASMAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static AbstractInsnNode findFirstInstructionAfter(MethodNode method, int
* @return the found instruction node or null if none matched before the given startIndex
*/
public static AbstractInsnNode findFirstInstructionBefore(MethodNode method, int opCode, int startIndex) {
for (int i = Math.max(method.instructions.size() - 1, startIndex); i >= 0; i--) {
for (int i = Math.min(method.instructions.size() - 1, startIndex); i >= 0; i--) {
AbstractInsnNode ain = method.instructions.get(i);
if (ain.getOpcode() == opCode) {
return ain;
Expand Down

0 comments on commit d4eca3c

Please sign in to comment.