Skip to content

Scheduling infrastructure for absolutely everyone.

fix: empty hosts array in filterHostsByLeadThreshold (#19343)

Carina Wollendorfer9a271f397b4d
diff --git a/packages/lib/bookings/filterHostsByLeadThreshold.ts b/packages/lib/bookings/filterHostsByLeadThreshold.ts
index dd598cab9a9..addb9b47126 100644
--- a/packages/lib/bookings/filterHostsByLeadThreshold.ts
+++ b/packages/lib/bookings/filterHostsByLeadThreshold.ts
@@ -103,7 +103,7 @@ export const filterHostsByLeadThreshold = async <T extends BaseHost<BaseUser>>({
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.
}