From b11050d32776c7995f9abd9953d7cebdcb899e7e Mon Sep 17 00:00:00 2001 From: Katie Wolfe Date: Sun, 21 Apr 2019 12:35:59 +0100 Subject: [PATCH] Check for sound before logging it Co-Authored-By: Half-Shot --- src/Notifier.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Notifier.js b/src/Notifier.js index d5810fe30d..c0c7fbdb94 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -122,7 +122,7 @@ const Notifier = { _playAudioNotification: function(ev, room) { this.getSoundForRoom(room.roomId).then((sound) => { - console.log(`Got sound ${sound.name || "default"} for ${room.roomId}`); + console.log(`Got sound ${sound && sound.name ? sound.name : "default"} for ${room.roomId}`); // XXX: How do we ensure this is a sound file and not // going to be exploited? const selector = document.querySelector(sound ? `audio[src='${sound.url}']` : "#messageAudio");