Changeset 6124


Ignore:
Timestamp:
Jun 10, 2008, 7:25:18 PM (14 years ago)
Author:
charles
Message:

(libT) add NULL pointer checks to tr_torrentStart(), tr_torrentStop()

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc-server.c

    r6121 r6124  
    116116
    117117    /* set a timer for the next pulse */
    118     if( EVBUFFER_LENGTH( server->in ) || EVBUFFER_LENGTH( server->out ) ) {
     118    if( EVBUFFER_LENGTH( server->in ) || EVBUFFER_LENGTH( server->out ) )
    119119        interval = BUSY_INTERVAL_MSEC;
    120     } else if( now - server->lastRequestTime < 300 ) {
     120    else if( now - server->lastRequestTime < 300 )
    121121        interval = IDLE_INTERVAL_MSEC;
    122     } else {
     122    else
    123123        interval = UNUSED_INTERVAL_MSEC;
    124     }
    125124    tv = tr_timevalMsec( interval );
    126125    evtimer_add( &server->timer, &tv );
  • trunk/libtransmission/torrent.c

    r6115 r6124  
    10381038tr_torrentStart( tr_torrent * tor )
    10391039{
    1040     torrentStart( tor, TRUE );
     1040    if( tor )
     1041        torrentStart( tor, TRUE );
    10411042}
    10421043
     
    10871088tr_torrentStop( tr_torrent * tor )
    10881089{
    1089     tr_globalLock( tor->handle );
    1090 
    1091     tor->isRunning = 0;
    1092     if( !tor->isDeleting )
    1093         tr_torrentSaveResume( tor );
    1094     tr_runInEventThread( tor->handle, stopTorrent, tor );
    1095 
    1096     tr_globalUnlock( tor->handle );
     1090    if( tor )
     1091    {
     1092        tr_globalLock( tor->handle );
     1093
     1094        tor->isRunning = 0;
     1095        if( !tor->isDeleting )
     1096            tr_torrentSaveResume( tor );
     1097        tr_runInEventThread( tor->handle, stopTorrent, tor );
     1098
     1099        tr_globalUnlock( tor->handle );
     1100    }
    10971101}
    10981102
     
    11141118tr_torrentFree( tr_torrent * tor )
    11151119{
    1116     if( tor != NULL )
     1120    if( tor )
    11171121    {
    11181122        tr_handle * handle = tor->handle;
Note: See TracChangeset for help on using the changeset viewer.