Explorar el Código

Add missing null check before disconnecting source

Adam Scott hace 1 año
padre
commit
1776258b1c
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      platform/web/js/libs/library_godot_audio.js

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

@@ -630,7 +630,9 @@ class SampleNode {
 	 * @returns {void}
 	 */
 	_restart() {
-		this._source.disconnect();
+		if (this._source != null) {
+			this._source.disconnect();
+		}
 		this._source = GodotAudio.ctx.createBufferSource();
 		this._source.buffer = this.getSample().getAudioBuffer();