Skip to content

Node.js based forum software built for the modern web

don't crash on missing user

Barış Soner Uşaklı1ced3eb9f1fb
diff --git a/src/controllers/accounts/follow.js b/src/controllers/accounts/follow.js
index 58dba7f3c0..7a28374582 100644
--- a/src/controllers/accounts/follow.js
+++ b/src/controllers/accounts/follow.js
@@ -14,8 +14,11 @@ followController.getFollowers = async function (req, res, next) {
await getFollow('account/followers', 'followers', req, res, next);
};
-async function getFollow(tpl, name, req, res) {
+async function getFollow(tpl, name, req, res, next) {
const { userData: payload } = res.locals;
+ if (!payload) {
+ return next();
+ }
const {
username, userslug, followerCount, followingCount,
} = payload;