Explorar o código

Fix Audio stop() (#25336)

* Fix Audio stop()

Fix stop()

When source is null, the method will throw an Exception

* Update Audio.js

Co-authored-by: mrdoob <info@mrdoob.com>
Maxime Scharwath %!s(int64=3) %!d(string=hai) anos
pai
achega
596a98774d
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      src/audio/Audio.js

+ 7 - 2
src/audio/Audio.js

@@ -169,8 +169,13 @@ class Audio extends Object3D {
 
 		this._progress = 0;
 
-		this.source.stop();
-		this.source.onended = null;
+		if ( this.source !== null ) {
+
+			this.source.stop();
+			this.source.onended = null;
+
+		}
+
 		this.isPlaying = false;
 
 		return this;

粤ICP备19079148号