Added code guards.

This commit is contained in:
Ylian Saint-Hilaire 2021-03-26 14:50:08 -07:00
parent 79ce9b7f71
commit 7709481345
2 changed files with 2 additions and 0 deletions

View File

@ -1637,6 +1637,7 @@
}
case 'accountchange': {
// An account was created or changed
if ((typeof message.event.account != 'object') || (message.event.account == null)) { console.log(message.event); return; };
if (userinfo.name == message.event.account.name) {
var newsiteadmin = message.event.account.siteadmin ? message.event.account.siteadmin : 0;
var oldsiteadmin = userinfo.siteadmin ? userinfo.siteadmin : 0;

View File

@ -2693,6 +2693,7 @@
case 'accountcreate':
case 'accountchange': {
// An account was created or changed
if ((typeof message.event.account != 'object') || (message.event.account == null)) console.log(message.event); return;
if (userinfo._id == message.event.account._id) {
var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;