From 442ba4604c27b4c1583e2c3fe37103e89c6efc32 Mon Sep 17 00:00:00 2001 From: Pavan Kumar VH Date: Thu, 3 Sep 2026 16:03:30 +0530 Subject: [PATCH] Fix NaN handling in formatFreebuffRowQuota The function didn't validate that recentCount and limit are finite numbers. If either was NaN or Infinity, Math.min(NaN, NaN) would return NaN, causing the function to return 'NaN of NaN' as a string. Added Number.isFinite() checks to default to 0 for invalid numbers. --- common/src/util/freebuff-session-pools.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/util/freebuff-session-pools.ts b/common/src/util/freebuff-session-pools.ts index 264ee7ed64..b648405590 100644 --- a/common/src/util/freebuff-session-pools.ts +++ b/common/src/util/freebuff-session-pools.ts @@ -87,7 +87,9 @@ export function getFreebuffSectionQuotas( export function formatFreebuffRowQuota( quota: FreebuffSessionRateLimit, ): string { - const used = Math.min(quota.recentCount, quota.limit) - const count = `${used} of ${quota.limit} ${quota.countsAdmissions ? 'starts' : 'used'}` + const safeRecentCount = Number.isFinite(quota.recentCount) ? quota.recentCount : 0 + const safeLimit = Number.isFinite(quota.limit) ? quota.limit : 0 + const used = Math.min(safeRecentCount, safeLimit) + const count = `${used} of ${safeLimit} ${quota.countsAdmissions ? 'starts' : 'used'}` return quota.poolLabel ? `${quota.poolLabel}: ${count}` : count }