Commit f717226b authored by Rick Waldron's avatar Rick Waldron

Only splice from internal arrays when item actually exists.

Signed-off-by: 's avatarRick Waldron <waldron.rick@gmail.com>
parent b9cdc413
...@@ -122,8 +122,11 @@ Data.prototype = { ...@@ -122,8 +122,11 @@ Data.prototype = {
}, },
discard: function( owner ) { discard: function( owner ) {
var index = this.owners.indexOf( 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; return this;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment