From 5ddf108edb12e830b4c52d9279a928e62d72a1b4 Mon Sep 17 00:00:00 2001 From: Jonathan Raoult Date: Sun, 1 Mar 2015 18:36:29 +1100 Subject: [PATCH] fixed a bug in playersPool where a comparison on player objects was to deep and was triggering an exception --- src/main/playersPool.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/playersPool.js b/src/main/playersPool.js index f962cc3..72dd506 100644 --- a/src/main/playersPool.js +++ b/src/main/playersPool.js @@ -47,7 +47,11 @@ function playersPool(config) { function releasePlayer(player) { var playersCache = _playersCacheByProvider[player.provider]; - var playerCacheEntry = find(playersCache, {player: player}); + + // don't leverage the deep comparison of find, just a shallow (identity) comparison + var playerCacheEntry = find(playersCache, function(entry) { + return entry.player === player; + }); if (!playerCacheEntry) { throw new Error('Found a foreign player instance registered in the pool');