Skip to content

Commit 5b7e016

Browse files
committed
fix(billing): add Number.isFinite check to lastPeriodCost
1 parent 2b3edbd commit 5b7e016

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/sim/lib/billing/client/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export function getUsage(subscriptionData: SubscriptionData | null | undefined):
6161
isExceeded: Boolean(usage.isExceeded),
6262
billingPeriodStart: usage.billingPeriodStart ?? null,
6363
billingPeriodEnd: usage.billingPeriodEnd ?? null,
64-
lastPeriodCost: typeof usage.lastPeriodCost === 'number' ? usage.lastPeriodCost : 0,
64+
lastPeriodCost:
65+
typeof usage.lastPeriodCost === 'number' && Number.isFinite(usage.lastPeriodCost)
66+
? usage.lastPeriodCost
67+
: 0,
6568
}
6669
}
6770

0 commit comments

Comments
 (0)