Skip to content

Commit 96b7592

Browse files
committed
fix exception when updating cart using coupons
1 parent 531f8ac commit 96b7592

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ All notable changes to this project will be documented in this file.
66
### Added
77
- Added support for Google Pay
88

9+
### Fixed
10+
- Fixed exceptions when using coupons that affect the whole cart
11+
912
## [0.38.1]
1013

1114
### Updated

core/src/main/java/io/snabble/sdk/ShoppingCartUpdater.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ private void commitCartUpdate(int modCount, CheckoutApi.SignedCheckoutInfo signe
202202

203203
if (lineItem.type == CheckoutApi.LineItemType.COUPON) {
204204
ShoppingCart.Item refersTo = cart.getByItemId(lineItem.refersTo);
205-
refersTo.setManualCouponApplied(lineItem.redeemed);
205+
if (refersTo != null) {
206+
refersTo.setManualCouponApplied(lineItem.redeemed);
207+
}
206208
}
207209
}
208210
}

0 commit comments

Comments
 (0)