Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 2579b7c

Browse files
committed
Check error conditions
1 parent 500b2bc commit 2579b7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/order.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,9 @@ func (n *OpenBazaarNode) CheckoutBreakdown(data *repo.PurchaseData) (repo.Checko
886886

887887
// Get base price of item
888888
v5Order, err := repo.ToV5Order(contract.BuyerOrder, n.LookupCurrency)
889+
if err != nil {
890+
return emptyCheckoutBreakdown, err
891+
}
889892
firstItem := v5Order.Items[0]
890893

891894
nrl, err := GetNormalizedListing(firstItem.ListingHash, contract)
@@ -930,6 +933,9 @@ func (n *OpenBazaarNode) CheckoutBreakdown(data *repo.PurchaseData) (repo.Checko
930933
return emptyCheckoutBreakdown, err
931934
}
932935
couponDiscount, err := GetTotalCouponCodeDiscount(nrl, firstItem.CouponCodes)
936+
if err != nil {
937+
return emptyCheckoutBreakdown, err
938+
}
933939
couponDiscount = couponDiscount.Mul(couponDiscount, new(big.Int).SetInt64(-1))
934940
couponCurrencyValue := repo.NewCurrencyValueFromBigInt(couponDiscount, listingCurDef)
935941

0 commit comments

Comments
 (0)