From 6e5e1250489ac4cc6cf67efb55c133abcea9d136 Mon Sep 17 00:00:00 2001 From: CubeWhy Date: Tue, 15 Oct 2024 06:45:22 +0800 Subject: [PATCH] fix: Redeemer is null --- src/main/java/fuck/manthe/nmsl/controller/UserController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fuck/manthe/nmsl/controller/UserController.java b/src/main/java/fuck/manthe/nmsl/controller/UserController.java index 904c70d..8b431e3 100644 --- a/src/main/java/fuck/manthe/nmsl/controller/UserController.java +++ b/src/main/java/fuck/manthe/nmsl/controller/UserController.java @@ -93,7 +93,7 @@ public ResponseEntity> forgetPassword(@RequestBody ForgetPasswo } RedeemCode redeemCode = redeemService.infoOrNull(dto.getRedeemCode()); - if (redeemCode == null || redeemCode.isAvailable() || redeemCode.getRedeemer().getId().equals(user.getId())) { + if (redeemCode == null || redeemCode.isAvailable() || redeemCode.getRedeemer() == null || !redeemCode.getRedeemer().getId().equals(user.getId())) { // 邀请码找不到或者根本没被人用过 // 写到一起是为了防止被刷API return new ResponseEntity<>(RestBean.failure(404, "Code not found."), HttpStatus.NOT_FOUND);