Skip to content

Commit

Permalink
fixed a bug in playersPool where a comparison on player objects was t…
Browse files Browse the repository at this point in the history
…o deep and was triggering an exception
  • Loading branch information
Jonathan Raoult committed Mar 1, 2015
1 parent bdcf526 commit 5ddf108
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/playersPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 5ddf108

Please sign in to comment.