Skip to content

Commit

Permalink
fix: handle exception when barcode is null
Browse files Browse the repository at this point in the history
  • Loading branch information
inh2613 committed Oct 31, 2023
1 parent 64630ad commit 3253670
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ public VoucherReadResponseDto mapToDto(Voucher voucher) {
public boolean isDuplicateVoucher(String username, String barcode) {
List<Voucher> 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;
}
}
Expand Down

0 comments on commit 3253670

Please sign in to comment.