diff --git a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/UserAddressServiceImpl.java b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/UserAddressServiceImpl.java index 70162c2fd..59ebbfb81 100644 --- a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/UserAddressServiceImpl.java +++ b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/UserAddressServiceImpl.java @@ -94,6 +94,9 @@ public class UserAddressServiceImpl implements UserAddressService { @Override public CommonResult getAddress(Integer userId, Integer id) { UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, id); + if (userAddress == null) { + return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_GET_ADDRESS_NOT_EXISTS.getCode()); + } if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) { return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());