Changeset 7126


Ignore:
Timestamp:
Nov 17, 2008, 5:05:11 AM (10 years ago)
Author:
charles
Message:

#1476: crash on exit when stats window is open

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/stats.c

    r6896 r7126  
    1111 */
    1212
    13 #include <assert.h>
    14 
    1513#include "transmission.h"
    1614#include "bencode.h"
     
    132130getStats( const tr_handle * handle )
    133131{
    134     return handle->sessionStats;
     132    return handle ? handle->sessionStats : NULL;
    135133}
    136134
     
    164162{
    165163    const struct tr_stats_handle * stats = getStats( handle );
    166 
    167     assert( stats );
    168     *setme = stats->single;
    169     setme->secondsActive = time( NULL ) - stats->startTime;
    170     updateRatio( setme );
     164    if( stats )
     165    {
     166        *setme = stats->single;
     167        setme->secondsActive = time( NULL ) - stats->startTime;
     168        updateRatio( setme );
     169    }
    171170}
    172171
     
    176175{
    177176    const struct tr_stats_handle * stats = getStats( handle );
    178     tr_session_stats               current;
    179 
    180     assert( stats );
    181     tr_sessionGetStats( handle, &current );
    182     addStats( setme, &stats->old, &current );
     177    tr_session_stats current;
     178
     179    if( stats )
     180    {
     181        tr_sessionGetStats( handle, &current );
     182        addStats( setme, &stats->old, &current );
     183    }
    183184}
    184185
Note: See TracChangeset for help on using the changeset viewer.