From 0b4364424630a75229b60f4e714b86da9f0a757e Mon Sep 17 00:00:00 2001 From: madisoncarter1234 Date: Fri, 28 Nov 2025 10:32:17 -0500 Subject: [PATCH] Fix: Add validation for empty payment items in private listings Prevents undefined access error when constructing private listing counter orders. If paymentItems array is empty after filtering, accessing paymentItems[0] on lines 37, 59-61 would crash. Added check to throw descriptive error if no payment items are found. --- src/orders/privateListings.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/orders/privateListings.ts b/src/orders/privateListings.ts index 5ce9b3cf2..5b45aee55 100644 --- a/src/orders/privateListings.ts +++ b/src/orders/privateListings.ts @@ -28,6 +28,12 @@ export const constructPrivateListingCounterOrder = ( item.recipient.toLowerCase() !== privateSaleRecipient.toLowerCase(), ); + if (paymentItems.length === 0) { + throw new Error( + "The consideration for the private listing did not contain any payment items", + ); + } + if (!paymentItems.every((item) => isCurrencyItem(item))) { throw new Error( "The consideration for the private listing did not contain only currency items",