提交 592eef3c 编写于 作者: S Skylot

fix: resolve NPE in enum processing

上级 0541748e
......@@ -192,12 +192,13 @@ public class EnumVisitor extends AbstractVisitor {
if (ctrMth != null) {
markArgsForSkip(ctrMth);
}
if (co.getResult().getSVar().getUseList().size() <= 2) {
RegisterArg coResArg = co.getResult();
if (coResArg == null || coResArg.getSVar().getUseList().size() <= 2) {
InsnRemover.removeWithoutUnbind(classInitMth, staticBlock, co);
} else {
// constructor result used in other places -> replace constructor with enum field get (SGET)
IndexInsnNode enumGet = new IndexInsnNode(InsnType.SGET, enumField.getField().getFieldInfo(), 0);
enumGet.setResult(co.getResult().duplicate());
enumGet.setResult(coResArg.duplicate());
BlockUtils.replaceInsn(classInitMth, staticBlock, co, enumGet);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册