(trunk web) make sure the torrent array doesn't change between getting the index and accessing it

This commit is contained in:
Kevin Glowacz 2009-06-06 22:17:24 +00:00
parent 38a032b1bf
commit cbd95c8680
1 changed files with 3 additions and 2 deletions

View File

@ -642,8 +642,9 @@ Torrent.indexOf = function( torrents, id )
*/ */
Torrent.lookup = function( torrents, id ) Torrent.lookup = function( torrents, id )
{ {
var pos = Torrent.indexOf( torrents, id ); var immutable_array = torrents.slice();
return pos >= 0 ? torrents[pos] : null; var pos = Torrent.indexOf( immutable_array, id );
return pos >= 0 ? immutable_array[pos] : null;
}; };
function TorrentFile(file_data) { function TorrentFile(file_data) {