diff --git a/src/Routes/authentication.ts b/src/Routes/authentication.ts index 2c894bd7..007a8922 100644 --- a/src/Routes/authentication.ts +++ b/src/Routes/authentication.ts @@ -258,7 +258,7 @@ router.get( ); router.get("/logout", async (req, res, next) => { - if (!req.user.impersonator) { + if (req.user && !req.user.impersonator) { req.session.logoutJust = true; if (req.user.db.rank.admin) await tokenManager.tokenReset(req.user.id);