From 1ab22024e12e3ea090bfedbca4f79eea1506de6c Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 2 Jun 2024 19:03:54 +0200 Subject: [PATCH] fix --- shared/functions/UtilsProjectCounts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/functions/UtilsProjectCounts.ts b/shared/functions/UtilsProjectCounts.ts index 54f9a77..4173c44 100644 --- a/shared/functions/UtilsProjectCounts.ts +++ b/shared/functions/UtilsProjectCounts.ts @@ -42,7 +42,7 @@ export async function checkProjectCount(project_id: string) { const projectCounts = await ProjectCountModel.findOne({ project_id }, {}, { sort: { billing_expire_at: -1 } }); - const billingExpireAt = new Date(projectCounts.billing_expire_at).getTime(); + const billingExpireAt = projectCounts ? new Date(projectCounts.billing_expire_at).getTime() : -1; if (projectCounts && Date.now() < billingExpireAt) { if (projectCounts.ai_limit) return projectCounts.toJSON();