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 f717226b3a44f918eec30b2d59ab257270189bc3
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/data.js
@@ -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.
You can’t perform that action at this time.