mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 22:17:14 +03:00
Don't fail if row is undefined
This commit is contained in:
@@ -66,7 +66,7 @@ export async function setUsername(req: Request, res: Response) {
|
||||
const locked = adminUserIDInput === undefined ? 0 : 1;
|
||||
let oldUserName = '';
|
||||
|
||||
if (row.userName && row.userName.length !== 0) {
|
||||
if (row?.userName?.length > 0) {
|
||||
//already exists, update this row
|
||||
oldUserName = row.userName;
|
||||
await db.prepare('run', `UPDATE "userNames" SET "userName" = ?, "locked" = ? WHERE "userID" = ?`, [userName, locked, userID]);
|
||||
|
||||
Reference in New Issue
Block a user