Fix NPE when decompiling constructor #654

This commit is contained in:
Maxim Degtyarev
2018-04-27 15:01:55 +03:00
committed by Egor Ushakov
parent 7c8e64da81
commit a74a9d7d25
8 changed files with 212 additions and 4 deletions

View File

@@ -1,12 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.rels.ClassWrapper;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair;
import java.util.ArrayList;
@@ -25,7 +24,11 @@ public class ExprUtil {
ClassWrapper wrapper = node.getWrapper();
if (wrapper != null) {
// own class
mask = wrapper.getMethodWrapper(CodeConstants.INIT_NAME, descriptor).synthParameters;
MethodWrapper methodWrapper = wrapper.getMethodWrapper(CodeConstants.INIT_NAME, descriptor);
if (methodWrapper == null) {
return null;
}
mask = methodWrapper.synthParameters;
}
else if (parameters > 0 && node.type == ClassNode.CLASS_MEMBER && (node.access & CodeConstants.ACC_STATIC) == 0) {
// non-static member class