fix: resolve NPE in enum processing
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user