Merge pull request #3216 from matrix-org/bwindels/fix-powerlevels-crash

Check content and content.users in power levels
This commit is contained in:
Bruno Windels 2019-07-12 16:59:16 +00:00 committed by GitHub
commit 380639516b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -416,7 +416,8 @@ function textForEncryptionEvent(event) {
// Currently will only display a change if a user's power level is changed
function textForPowerEvent(event) {
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 '';
}
const userDefault = event.getContent().users_default || 0;