Skip to content

Commit f3c92a5

Browse files
committed
Fixed minor issue...
1 parent fb35849 commit f3c92a5

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

src/main/java/org/mangorage/mangobotmixin/plugin/MangoBotMixinPlugin.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ public void load() {
2020
System.out.println("Loaded MangoBotMixinPlugin");
2121
IMangoLoader mangoLoader = (IMangoLoader) this.getClass().getClassLoader();
2222

23-
final var history = mangoLoader.getTransformerHistory().getHistory("org.mangorage.mangobotcore.internal.ExampleThing");
24-
final var result = history.get(1);
25-
26-
System.out.println("Transformed class bytes:");
27-
ClassReader cr = new ClassReader(result.transformerResult());
28-
cr.accept(new org.objectweb.asm.util.TraceClassVisitor(new java.io.PrintWriter(System.out)), 0);
29-
30-
System.out.println("Original class bytes:");
31-
ClassReader cr2 = new ClassReader(result.classData());
32-
cr2.accept(new org.objectweb.asm.util.TraceClassVisitor(new java.io.PrintWriter(System.out)), 0);
23+
final var transformerHistory = mangoLoader.getTransformerHistory();
24+
if (transformerHistory != null) {
25+
final var history = transformerHistory.getHistory("org.mangorage.mangobotcore.internal.ExampleThing");
26+
if (history == null || history.size() == 1) return;
27+
28+
final var result = history.get(1);
29+
System.out.println("Transformed class bytes:");
30+
ClassReader cr = new ClassReader(result.transformerResult());
31+
cr.accept(new org.objectweb.asm.util.TraceClassVisitor(new java.io.PrintWriter(System.out)), 0);
32+
33+
System.out.println("Original class bytes:");
34+
ClassReader cr2 = new ClassReader(result.classData());
35+
cr2.accept(new org.objectweb.asm.util.TraceClassVisitor(new java.io.PrintWriter(System.out)), 0);
36+
}
3337
}
3438
}

0 commit comments

Comments
 (0)