From 073fdc7b0e610d974a4981e6f9d97ff23edf8225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 6 Mar 2020 12:33:41 +0100 Subject: [PATCH] sperakerstats: prevent access of nil object (#5112) If the dominant speaker leaves their object will be gone from the mapping. --- resources/prosody-plugins/mod_speakerstats_component.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/prosody-plugins/mod_speakerstats_component.lua b/resources/prosody-plugins/mod_speakerstats_component.lua index f32500802..7f30f6cc4 100644 --- a/resources/prosody-plugins/mod_speakerstats_component.lua +++ b/resources/prosody-plugins/mod_speakerstats_component.lua @@ -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