Skip to content
Permalink
Browse files
Only splice from internal arrays when item actually exists.
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
  • Loading branch information
rwaldron committed Dec 31, 2012
1 parent b9cdc41 commit f717226
Showing 1 changed file with 5 additions and 2 deletions.
@@ -122,8 +122,11 @@ Data.prototype = {
},
discard: function( owner ) {
var index = this.owners.indexOf( owner );
this.owners.splice( index, 1 );
this.cache.splice( index, 1 );

if ( index >= 0 ) {
this.owners.splice( index, 1 );
this.cache.splice( index, 1 );
}
return this;
}
};

0 comments on commit f717226

Please sign in to comment.