also check content and content.users before proceeding

This commit is contained in:
Bruno Windels 2019-07-12 18:50:13 +02:00 committed by David Baker
parent f05a7b2195
commit 02ec96cff1

View file

@ -416,7 +416,8 @@ function textForEncryptionEvent(event) {
// Currently will only display a change if a user's power level is changed // Currently will only display a change if a user's power level is changed
function textForPowerEvent(event) { function textForPowerEvent(event) {
const senderName = event.sender ? event.sender.name : event.getSender(); const senderName = event.sender ? event.sender.name : event.getSender();
if (!event.getPrevContent() || !event.getPrevContent().users) { if (!event.getPrevContent() || !event.getPrevContent().users ||
!event.getContent() || !event.getContent().users) {
return ''; return '';
} }
const userDefault = event.getContent().users_default || 0; const userDefault = event.getContent().users_default || 0;