sperakerstats: prevent access of nil object (#5112)

If the dominant speaker leaves their object will be gone from the mapping.
This commit is contained in:
Saúl Ibarra Corretgé 2020-03-06 12:33:41 +01:00 committed by GitHub
parent fedaa0ae6e
commit 073fdc7b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -53,7 +53,10 @@ function on_message(event)
local oldDominantSpeakerId = roomSpeakerStats['dominantSpeakerId'];
if oldDominantSpeakerId then
roomSpeakerStats[oldDominantSpeakerId]:setDominantSpeaker(false);
local oldDominantSpeaker = roomSpeakerStats[oldDominantSpeakerId];
if oldDominantSpeaker then
oldDominantSpeaker:setDominantSpeaker(false);
end
end
if newDominantSpeaker then