diff --git a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java index 5b435d79..ac4088ac 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherService.java @@ -275,7 +275,8 @@ public VoucherReadResponseDto mapToDto(Voucher voucher) { public boolean isDuplicateVoucher(String username, String barcode) { List vouchers = voucherRepository.findAllByUserUsername(username); for (Voucher voucher : vouchers) { - if (voucher.getBarcode().equals(barcode)) { + String voucherBarcode = voucher.getBarcode(); + if (voucherBarcode != null && voucherBarcode.equals(barcode)) { return true; } }