0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

Catch bad assumption in unlogged saves

This commit is contained in:
David Bolack
2024-02-28 08:32:15 -06:00
parent 1a467565c1
commit 544bc9bd01

View File

@@ -154,7 +154,7 @@ const api = {
throw { name: 'BrewLoad Error', message: 'Brew not found', status: 404, HBErrorCode: '05', accessType: accessType, brewId: id };
}
const userID = accessType === 'edit' ? req.account.username : stub.authors[0];
const userID = req?.account?.username && (accessType === 'edit') ? req.account.username : stub.authors[0];
// Clean up brew: fill in missing fields with defaults / fix old invalid values
const userThemes = await getUsersBrewThemes(userID, id);