From fc0d8cf31dadf87ba25d1c776162d9851065f41f Mon Sep 17 00:00:00 2001 From: Pavan Kumar VH Date: Thu, 3 Sep 2026 13:01:47 +0530 Subject: [PATCH] Fix NaN handling in formatPlanUnits The function didn't validate that units is a finite number. If units was NaN or Infinity, Math.round(units * 10) / 10 would return NaN, causing the function to return 'NaN' as a string. Added Number.isFinite() check to return '0' for invalid numbers. --- common/src/util/freebuff-plan-summary.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/util/freebuff-plan-summary.ts b/common/src/util/freebuff-plan-summary.ts index 5878c77bf0..e7790379fb 100644 --- a/common/src/util/freebuff-plan-summary.ts +++ b/common/src/util/freebuff-plan-summary.ts @@ -40,6 +40,7 @@ export interface FreebuffPlanSummary { /** Session units, without trailing ".0" noise: 2, 0.5, 1.5. */ export function formatPlanUnits(units: number): string { + if (!Number.isFinite(units)) return '0' const rounded = Math.round(units * 10) / 10 return Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1) }