Browse Source

fix(features/notifications): crash on undefined participant

master
paweldomas 5 years ago
parent
commit
14855f3255
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      react/features/notifications/middleware.js

+ 3
- 2
react/features/notifications/middleware.js View File

@@ -84,9 +84,10 @@ MiddlewareRegistry.register(store => next => action => {
84 84
 
85 85
         const { id, role } = action.participant;
86 86
         const state = store.getState();
87
-        const { role: oldRole } = getParticipantById(state, id);
87
+        const oldParticipant = getParticipantById(state, id);
88
+        const oldRole = oldParticipant?.role;
88 89
 
89
-        if (oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) {
90
+        if (oldRole && oldRole !== role && role === PARTICIPANT_ROLE.MODERATOR) {
90 91
             const displayName = getParticipantDisplayName(state, id);
91 92
 
92 93
             store.dispatch(showNotification({

Loading…
Cancel
Save