From f717226b3a44f918eec30b2d59ab257270189bc3 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 31 Dec 2012 18:06:38 -0500 Subject: [PATCH] Only splice from internal arrays when item actually exists. Signed-off-by: Rick Waldron --- src/data.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data.js b/src/data.js index 6e1465b3b..e6915e9b8 100644 --- a/src/data.js +++ b/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; } };