From 6d94a33f2ddc43af54928e658ced4e95a682e275 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 3 Mar 2011 17:28:04 +0000 Subject: [PATCH] (trunk libT) #4070 "assertion failure happens soon after startup" -- fixed. Thanks to User294 for helping to track down the problem. --- libtransmission/peer-mgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index df2156a7f..e8bff23c1 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1608,7 +1608,6 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt ) torrentLock( t ); assert( peer != NULL ); - assert( peer->atom != NULL ); switch( e->eventType ) { @@ -1630,7 +1629,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt ) tr_statsAddUploaded( tor->session, e->length ); /* update our atom */ - if( e->wasPieceData ) + if( peer->atom && e->wasPieceData ) peer->atom->piece_data_time = now; break; @@ -1671,7 +1670,8 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt ) break; case TR_PEER_CLIENT_GOT_PORT: - peer->atom->port = e->port; + if( peer->atom ) + peer->atom->port = e->port; break; case TR_PEER_CLIENT_GOT_SUGGEST: @@ -1699,7 +1699,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt ) tr_statsAddDownloaded( tor->session, e->length ); /* update our atom */ - if( e->wasPieceData ) + if( peer->atom && e->wasPieceData ) peer->atom->piece_data_time = now; break;