From 9a271f397b4d67a51333285fb566af9b34e1909c Mon Sep 17 00:00:00 2001 From: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Date: Tue, 18 Feb 2025 19:19:44 +0100 Subject: [PATCH] fix: empty hosts array in filterHostsByLeadThreshold (#19343) * return early if hosts is empty * feedback Co-authored-by: Alex van Andel --------- Co-authored-by: CarinaWolli Co-authored-by: Alex van Andel --- packages/lib/bookings/filterHostsByLeadThreshold.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/bookings/filterHostsByLeadThreshold.ts b/packages/lib/bookings/filterHostsByLeadThreshold.ts index dd598cab9a..addb9b4712 100644 --- a/packages/lib/bookings/filterHostsByLeadThreshold.ts +++ b/packages/lib/bookings/filterHostsByLeadThreshold.ts @@ -103,7 +103,7 @@ export const filterHostsByLeadThreshold = async >({ if (maxLeadThreshold === 0) { throw new Error(errorCodes.MAX_LEAD_THRESHOLD_FALSY); } - if (maxLeadThreshold === null) { + if (maxLeadThreshold === null || hosts.length < 1) { return hosts; // don't apply filter. }