From 3ac0ac7568bba51e85a9cb3c2fb9fa355ea38e88 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 13 Oct 2023 23:44:34 -0400 Subject: [PATCH] Fix crash when not logged in If not logged in, brew.authors doesn't exist, so visiting the share page crashes. --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 4b9dd0528..a19030b3a 100644 --- a/server/app.js +++ b/server/app.js @@ -328,7 +328,7 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r }; // increase visitor view count, do not include visits by author(s) - if(brew.authors.includes(req.account.username) === false){ + if(!brew.authors.includes(req.account?.username)){ if(req.params.id.length > 12 && !brew._id) { const googleId = brew.googleId; const shareId = brew.shareId;