Only splice from internal arrays when item actually exists.

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
This commit is contained in:
Rick Waldron 2012-12-31 18:06:38 -05:00
parent b9cdc4136b
commit f717226b3a

View File

@ -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;
}
};