Skip to content

Commit

Permalink
fix printWarnings NPE when class null
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jul 8, 2024
1 parent 40a2c6d commit 9113f54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true

version=0.8.0
version=0.8.1

asm_version=9.7

Expand Down
14 changes: 8 additions & 6 deletions src/main/java/xyz/wagyourtail/jvmdg/version/VersionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,10 @@ public boolean isInitialized() {
}

public ClassNode downgrade(final ClassDowngrader downgrader, ClassNode clazz, final Set<ClassNode> extra, final boolean enableRuntime, final Function<String, ClassNode> getReadOnly) throws IOException {
String className = clazz.name;

if (clazz.version != inputVersion)
throw new IllegalArgumentException("Class " + clazz.name + " is not version " + inputVersion);
throw new IllegalArgumentException("Class " + className + " is not version " + inputVersion);

ensureInit(downgrader);
final Set<String> warnings = new LinkedHashSet<>();
Expand Down Expand Up @@ -800,7 +802,7 @@ public List<Pair<Type, Boolean>> apply(Type o) throws IOException {

clazz = stubClasses(clazz, enableRuntime, warnings);
if (clazz == null) {
printWarnings(warnings, clazz.name);
printWarnings(warnings, className);
return null;
}
clazz = stubWithExtras(clazz, extra, new IOFunction<ClassNode, ClassNode>() {
Expand All @@ -810,7 +812,7 @@ public ClassNode apply(ClassNode classNode) throws IOException {
}
});
if (clazz == null) {
printWarnings(warnings, clazz.name);
printWarnings(warnings, className);
return null;
}
clazz = stubWithExtras(clazz, extra, new IOFunction<ClassNode, ClassNode>() {
Expand All @@ -820,7 +822,7 @@ public ClassNode apply(ClassNode classNode) throws IOException {
}
});
if (clazz == null) {
printWarnings(warnings, clazz.name);
printWarnings(warnings, className);
return null;
}
clazz = stubWithExtras(clazz, extra, new IOFunction<ClassNode, ClassNode>() {
Expand All @@ -830,10 +832,10 @@ public ClassNode apply(ClassNode classNode) throws IOException {
}
});
if (clazz == null) {
printWarnings(warnings, clazz.name);
printWarnings(warnings, className);
return null;
}
printWarnings(warnings, clazz.name);
printWarnings(warnings, className);
clazz.version = inputVersion - 1;
return clazz;
}
Expand Down

0 comments on commit 9113f54

Please sign in to comment.