Browse Source

[Web] Gracefully handle non-finite audio volumes

A Thousand Ships 1 year ago
parent
commit
61c4ce272c
1 changed files with 4 additions and 1 deletions
  1. 4 1
      platform/web/js/libs/library_godot_audio.js

+ 4 - 1
platform/web/js/libs/library_godot_audio.js

@@ -858,7 +858,10 @@ class Bus {
 	 * @returns {void}
 	 * @returns {void}
 	 */
 	 */
 	setVolumeDb(val) {
 	setVolumeDb(val) {
-		this._gainNode.gain.value = GodotAudio.db_to_linear(val);
+		const linear = GodotAudio.db_to_linear(val);
+		if (isFinite(linear)) {
+			this._gainNode.gain.value = linear;
+		}
 	}
 	}
 
 
 	/**
 	/**