Skip to content

Commit

Permalink
Fix NPEs in ClassWriter and variable merging
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskarth committed Jan 10, 2025
1 parent a26d152 commit 7b4d19c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/org/jetbrains/java/decompiler/main/ClassWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1264,8 +1264,8 @@ else if (methodWrapper.varproc.getVarFinal(new VarVersionPair(index, 0)) == VarT
throwsExceptions = true;
buffer.append(" throws ");

boolean useDescriptor = hasDescriptor && !descriptor.exceptionTypes.isEmpty();
for (int i = 0; i < attr.getThrowsExceptions().size(); i++) {
boolean useDescriptor = descriptor != null && !descriptor.exceptionTypes.isEmpty();
for (int i = 0; i < (attr == null ? descriptor.exceptionTypes.size() : attr.getThrowsExceptions().size()); i++) {
if (i > 0) {
buffer.append(", ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ else if (obj instanceof Exprent) {
VarType t1 = this.varproc.getVarType(ret.getKey());
VarType t2 = this.varproc.getVarType(ret.getValue());

if (t1.isSuperset(t2) || t2.isSuperset(t1)) {
if (t1 != null && t2 != null && (t1.isSuperset(t2) || t2.isSuperset(t1))) {
// TODO: this only checks for totally disjoint types, there are instances where merging is incorrect with primitives

boolean ok = true;
Expand Down

0 comments on commit 7b4d19c

Please sign in to comment.