diff --git a/src/main/java/org/redkale/util/Copier.java b/src/main/java/org/redkale/util/Copier.java index 0b32ca9e6..d2c6b0ef0 100644 --- a/src/main/java/org/redkale/util/Copier.java +++ b/src/main/java/org/redkale/util/Copier.java @@ -16,7 +16,6 @@ import static org.redkale.asm.Opcodes.ACC_PUBLIC; import static org.redkale.asm.Opcodes.ACC_STATIC; import static org.redkale.asm.Opcodes.ACC_SUPER; import static org.redkale.asm.Opcodes.ACC_SYNTHETIC; -import static org.redkale.asm.Opcodes.ACONST_NULL; import static org.redkale.asm.Opcodes.ALOAD; import static org.redkale.asm.Opcodes.ARETURN; import static org.redkale.asm.Opcodes.ASTORE; @@ -207,7 +206,7 @@ public interface Copier extends BiFunction { .computeIfAbsent(srcClass, v -> { Copier copier = load(srcClass, destClass, options); Creator creator = Creator.load(destClass); - Function func = src -> copier.apply(src, creator.create()); + Function func = src -> src == null ? null : copier.apply(src, creator.create()); return func; }); } else { @@ -217,7 +216,7 @@ public interface Copier extends BiFunction { .computeIfAbsent(destClass, v -> { Copier copier = load(srcClass, destClass, options); Creator creator = Creator.load(destClass); - Function func = src -> copier.apply(src, creator.create()); + Function func = src -> src == null ? null : copier.apply(src, creator.create()); return func; }); } @@ -492,7 +491,7 @@ public interface Copier extends BiFunction { mv.visitVarInsn(ALOAD, 1); Label ifLabel = new Label(); mv.visitJumpInsn(IFNONNULL, ifLabel); - mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); mv.visitLabel(ifLabel); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); @@ -622,7 +621,7 @@ public interface Copier extends BiFunction { mv.visitVarInsn(ALOAD, 1); Label ifLabel = new Label(); mv.visitJumpInsn(IFNONNULL, ifLabel); - mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); mv.visitLabel(ifLabel); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);