From 5965d8d1aeabed253844487006a20fa7f505b214 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 16 Jan 2008 17:57:13 +0000 Subject: [PATCH] handle tr_torrentClose( NULL ) gracefully. --- libtransmission/torrent.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index be2e88ead..e0f0312cf 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -994,12 +994,15 @@ closeTorrent( void * vtor ) void tr_torrentClose( tr_torrent * tor ) { - tr_globalLock( tor->handle ); + if( tor != NULL ) + { + tr_globalLock( tor->handle ); - tr_torrentClearStatusCallback( tor ); - tr_runInEventThread( tor->handle, closeTorrent, tor ); + tr_torrentClearStatusCallback( tor ); + tr_runInEventThread( tor->handle, closeTorrent, tor ); - tr_globalUnlock( tor->handle ); + tr_globalUnlock( tor->handle ); + } } /**