fix: empty hosts array in filterHostsByLeadThreshold (#19343)

* return early if hosts is empty

* feedback

Co-authored-by: Alex van Andel <[email protected]>

---------

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-02-18 18:19:44 +00:00
1 parent 6847781a7f
commit 9a271f397b
1 file changed
+1 -1
@@ -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.
}