Ignore:
Timestamp:
Mar 4, 2013, 4:12:54 AM (9 years ago)
Author:
livings124
Message:

a tiny bit more safety by assigning the torrent directly, instead of getting the index

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r14039 r14040  
    47414741    {
    47424742        //get the torrent
    4743         Torrent * torrent = nil;
     4743        __block Torrent * torrent = nil;
    47444744        if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED && type != TR_RPC_SESSION_CLOSE))
    47454745        {
    4746             const NSUInteger index = [fTorrents indexOfObjectWithOptions:NSEnumerationConcurrent passingTest: ^BOOL(Torrent * checkTorrent, NSUInteger idx, BOOL * stop) {
    4747                 return torrentStruct == [checkTorrent torrentStruct];
     4746            [fTorrents enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(Torrent * checkTorrent, NSUInteger idx, BOOL *stop) {
     4747                if (torrentStruct == [checkTorrent torrentStruct])
     4748                    torrent = checkTorrent;
    47484749            }];
    47494750           
    4750             if (index == NSNotFound)
     4751            if (!torrent)
    47514752            {
    47524753                NSLog(@"No torrent found matching the given torrent struct from the RPC callback!");
    47534754                return;
    47544755            }
    4755             torrent = [fTorrents objectAtIndex: index];
    47564756        }
    47574757       
Note: See TracChangeset for help on using the changeset viewer.