Skip to content
Browse files

Fixed indexOf usages that causes RTE

  • Loading branch information...
1 parent c2e79a3 commit 03230a7afcad9fce737a09f18c73516cb6846fa0 @lannymcnie lannymcnie committed Sep 2, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/soundjs/SoundJS.js
View
10 src/soundjs/SoundJS.js
@@ -448,7 +448,10 @@ this.createjs = this.createjs||{};
if (!SoundChannel.add(instance, interrupt)) { return false; }
var result = instance.beginPlaying(offset, loop, volume, pan);
if (!result) {
- this.instances.splice(this.instances.indexOf(instance), 1);
+ var index = this.instances.indexOf(instance);
+ if (index > -1) {
+ this.instances.splice(index, 1);
+ }
delete this.instanceHash[instance.uniqueId];
return false;
}
@@ -603,7 +606,10 @@ this.createjs = this.createjs||{};
*/
s.playFinished = function(instance) {
SoundChannel.remove(instance);
- this.instances.splice(this.instances.indexOf(instance), 1);
+ var index = this.instances.indexOf(instance);
+ if (index > -1) {
+ this.instances.splice(index, 1);
+ }
// Note: Keep in instance hash.
}

0 comments on commit 03230a7

Please sign in to comment.
Something went wrong with that request. Please try again.