From 9e28db6ef7df990ee035b5e191727f8c0d3d3139 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 21 Jun 2020 15:51:36 -0400 Subject: [PATCH] Safely handle volume values that are out of range (#617) --- ext/mixed/js/display.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 380134ad..90fd1037 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -807,9 +807,10 @@ class Display { this._stopPlayingAudio(); + const volume = Math.max(0.0, Math.min(1.0, this.options.audio.volume / 100.0)); this.audioPlaying = audio; audio.currentTime = 0; - audio.volume = this.options.audio.volume / 100.0; + audio.volume = Number.isFinite(volume) ? volume : 1.0; const playPromise = audio.play(); if (typeof playPromise !== 'undefined') { try {