From 8c95cc4bb8014239f574f2b5e1a4b4e8808b0376 Mon Sep 17 00:00:00 2001 From: skinmaker1345 Date: Sat, 30 Sep 2023 23:06:51 +0900 Subject: [PATCH] fix: check given param is not null --- utils/Query.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/Query.ts b/utils/Query.ts index 034ed07..1b4ba27 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -597,9 +597,11 @@ async function resetServerToken(id: string, beforeToken: string) { return token } -async function Github(id: string, github: string) { - const user = await knex('users').where({ github }).whereNot({ id }) - if(github && user.length !== 0) return 0 +async function Github(id: string, github: string | null) { + if(github) { + const user = await knex('users').where({ github }).whereNot({ id }) + if(user.length !== 0) return 0 + } await knex('users').update({ github }).where({ id }) return 1 }