Check for sound before logging it

Co-Authored-By: Half-Shot <will@half-shot.uk>
This commit is contained in:
Katie Wolfe 2019-04-21 12:35:59 +01:00 committed by GitHub
parent 776210c135
commit b11050d327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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");