summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-06-16 13:35:36 +0500
committerilotterytea <iltsu@alright.party>2024-06-16 13:35:36 +0500
commit6014ce1bcffa14111dbb00f5b143510d753dc5a1 (patch)
tree670717884dcc5d0e4ce67323ad4bee281bbda049
parent1257782012bc5a1f7e5d2b8e3025543b2899d499 (diff)
fix: handle "volumeHtml is null"
-rw-r--r--scripts/microphone.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/microphone.js b/scripts/microphone.js
index ebf648f..5f58245 100644
--- a/scripts/microphone.js
+++ b/scripts/microphone.js
@@ -30,7 +30,9 @@ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
const decibels = 20 * Math.log10(volume / 255);
- volumeHtml.innerText = `${decibels.toFixed(2)} dB`;
+ if (volumeHtml) {
+ volumeHtml.innerText = `${decibels.toFixed(2)} dB`;
+ }
const muted = localStorage.getItem("muted_img");
const speak = localStorage.getItem("speak_img");