Skip to content

Commit 087fb45

Browse files
maxscharwathmrdoob
authored andcommitted
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]>
1 parent e65bc14 commit 087fb45

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/audio/Audio.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ class Audio extends Object3D {
169169

170170
this._progress = 0;
171171

172-
this.source.stop();
173-
this.source.onended = null;
172+
if ( this.source !== null ) {
173+
174+
this.source.stop();
175+
this.source.onended = null;
176+
177+
}
178+
174179
this.isPlaying = false;
175180

176181
return this;

0 commit comments

Comments
 (0)