提交 395cae43 编写于 作者: A Ahmed Ashour 提交者: skylot

fix: handle NPE for methods with removed instructions (#342) (PR #583)

上级 eb77aa51
......@@ -51,7 +51,8 @@ public class ExtractFieldInit extends AbstractVisitor {
MethodNode clinit = cls.getClassInitMth();
if (clinit == null
|| !clinit.getAccessFlags().isStatic()
|| clinit.isNoCode()) {
|| clinit.isNoCode()
|| clinit.getBasicBlocks() == null) {
return;
}
......@@ -235,7 +236,7 @@ public class ExtractFieldInit extends AbstractVisitor {
}
private static List<InsnNode> getFieldAssigns(MethodNode mth, FieldNode field, InsnType putInsn) {
if (mth.isNoCode()) {
if (mth.isNoCode() || mth.getBasicBlocks() == null) {
return Collections.emptyList();
}
List<InsnNode> assignInsns = new ArrayList<>();
......
......@@ -218,7 +218,7 @@ public class ReSugarCode extends AbstractVisitor {
private static void initClsEnumMap(ClassNode enumCls) {
MethodNode clsInitMth = enumCls.getClassInitMth();
if (clsInitMth == null || clsInitMth.isNoCode()) {
if (clsInitMth == null || clsInitMth.isNoCode() || clsInitMth.getBasicBlocks() == null) {
return;
}
EnumMapAttr mapAttr = new EnumMapAttr();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册