Skip to content

Node.js based forum software built for the modern web

refactor: don't make db request if there is no code

Barış Soner Uşaklı53a2be9defea
diff --git a/src/user/email.js b/src/user/email.js
index aec9379f41..161a3b1b0f 100644
--- a/src/user/email.js
+++ b/src/user/email.js
@@ -53,7 +53,7 @@ UserEmail.getEmailForValidation = async (uid) => {
let email = '';
// check email from confirmObj
const code = await db.get(`confirm:byUid:${uid}`);
- const confirmObj = await db.getObject(`confirm:${code}`);
+ const confirmObj = code ? await db.getObject(`confirm:${code}`) : null;
if (confirmObj && confirmObj.email && parseInt(uid, 10) === parseInt(confirmObj.uid, 10)) {
email = confirmObj.email;
}