Skip to content

Commit cd02c9a

Browse files
committed
Prevent NPE on #getRecordComponents for Object
Requesting the record components from a struct class has a fallback to an empty list over null for objects that extend j.l.Record but do not have a record attribute. This fallback however assumes that the type has a superclass, which is not the case of j.l.Object, causing a NPE.
1 parent a1b7f6d commit cd02c9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/org/jetbrains/java/decompiler/struct/StructClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public ConstantPool getPool() {
213213
if (recordAttr == null) {
214214
// If our class extends j.l.Record but also has no components, it's probably malformed.
215215
// Force processing as a record anyway, in the hopes that we can come to a better result.
216-
if (this.superClass.getString().equals("java/lang/Record")) {
216+
if (this.superClass != null && this.superClass.getString().equals("java/lang/Record")) {
217217
return new ArrayList<>();
218218
}
219219

0 commit comments

Comments
 (0)