Browse Source

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 <[email protected]>
Maxime Scharwath 2 years ago
parent
commit
596a98774d
1 changed files with 7 additions and 2 deletions
  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;