From 56a493d87323afec745b10fcbb5bce5dded9ebd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 6 Feb 2019 10:33:04 -0500 Subject: [PATCH] fix: dont crash if userData is undefined #7262 --- src/user/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/user/index.js b/src/user/index.js index 40fda6ab91..6c81261e57 100644 --- a/src/user/index.js +++ b/src/user/index.js @@ -328,7 +328,9 @@ User.addInterstitials = function (callback) { if (!meta.config.gdpr_enabled) { return setImmediate(callback, null, data); } - + if (!data.userData) { + return setImmediate(callback, new Error('[[error:invalid-data]]')); + } const add = function () { data.interstitials.push({ template: 'partials/gdpr_consent', @@ -369,6 +371,10 @@ User.addInterstitials = function (callback) { // Forum Terms of Use function (data, callback) { + if (!data.userData) { + return setImmediate(callback, new Error('[[error:invalid-data]]')); + } + const add = function () { data.interstitials.push({ template: 'partials/acceptTos',