Procházet zdrojové kódy

fix(features/notifications): crash on undefined participant

master
paweldomas před 5 roky
rodič
revize
14855f3255
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 3
    2
      react/features/notifications/middleware.js

+ 3
- 2
react/features/notifications/middleware.js Zobrazit soubor

@@ -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({

Načítá se…
Zrušit
Uložit