Skip to content

Fix NaN handling in formatFreebuffRowQuota - #1247

Open
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/format-row-quota-nan-handling
Open

Fix NaN handling in formatFreebuffRowQuota#1247
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/format-row-quota-nan-handling

Conversation

@pavankumar-vh

Copy link
Copy Markdown

Overview

Fix NaN handling in the formatFreebuffRowQuota function in common/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 validation

Scope

This change only touches common/ which is an approved contribution area per the Contributing Guide.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant