diff --git a/CHANGELOG.md b/CHANGELOG.md index c3c12228cc..0b971ee536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ### Changed ### Removed ### Fixed +* ui: Avoid npe caused by `isEmpty()` check on a null shopping cart ## [0.72.4] ### Added diff --git a/ui/src/main/java/io/snabble/sdk/ui/cart/PaymentSelectionHelper.java b/ui/src/main/java/io/snabble/sdk/ui/cart/PaymentSelectionHelper.java index 71f56ba4d9..7b672e5584 100644 --- a/ui/src/main/java/io/snabble/sdk/ui/cart/PaymentSelectionHelper.java +++ b/ui/src/main/java/io/snabble/sdk/ui/cart/PaymentSelectionHelper.java @@ -415,8 +415,9 @@ public boolean shouldShowBigSelector() { } public boolean shouldShowPayButton() { - boolean onlinePaymentAvailable = cart.getAvailablePaymentMethods() != null && !cart.getAvailablePaymentMethods().isEmpty(); - return cart.getTotalPrice() >= 0 && (onlinePaymentAvailable || selectedEntry.getValue() != null); + final ShoppingCart shoppingCart = cart; + boolean onlinePaymentAvailable = shoppingCart.getAvailablePaymentMethods() != null && !shoppingCart.getAvailablePaymentMethods().isEmpty(); + return shoppingCart.getTotalPrice() >= 0 && (onlinePaymentAvailable || selectedEntry.getValue() != null); } public boolean shouldShowGooglePayButton() {