Skip to content

Commit 7b4d19c

Browse files
committed
Fix NPEs in ClassWriter and variable merging
1 parent a26d152 commit 7b4d19c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/org/jetbrains/java/decompiler/main/ClassWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ else if (methodWrapper.varproc.getVarFinal(new VarVersionPair(index, 0)) == VarT
12641264
throwsExceptions = true;
12651265
buffer.append(" throws ");
12661266

1267-
boolean useDescriptor = hasDescriptor && !descriptor.exceptionTypes.isEmpty();
1268-
for (int i = 0; i < attr.getThrowsExceptions().size(); i++) {
1267+
boolean useDescriptor = descriptor != null && !descriptor.exceptionTypes.isEmpty();
1268+
for (int i = 0; i < (attr == null ? descriptor.exceptionTypes.size() : attr.getThrowsExceptions().size()); i++) {
12691269
if (i > 0) {
12701270
buffer.append(", ");
12711271
}

src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ else if (obj instanceof Exprent) {
664664
VarType t1 = this.varproc.getVarType(ret.getKey());
665665
VarType t2 = this.varproc.getVarType(ret.getValue());
666666

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

670670
boolean ok = true;

0 commit comments

Comments
 (0)