Fix NaN handling in formatFreebuffRowQuota - #1247
Conversation
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.
|
Thanks for taking a look at That said, the PR doesn't show where To make this a solid port candidate:
Right instinct, but as-is this reads like a speculative fix rather than one grounded in an observed failure. |
Overview
Fix NaN handling in the
formatFreebuffRowQuotafunction incommon/src/util/freebuff-session-pools.ts.Bug Description
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.Fix
Added
Number.isFinite()checks to default to 0 for invalid numbers.Testing
No existing tests for this function, but the fix prevents incorrect behavior with invalid inputs.
Files Changed
common/src/util/freebuff-session-pools.ts- Added NaN validationScope
This change only touches
common/which is an approved contribution area per the Contributing Guide.