(trunk libT) fix crash-on-add-torrent-from-clutch reported by anf6

This commit is contained in:
Charles Kerr 2009-01-20 02:03:09 +00:00
parent 8f5e8e1599
commit dfd5c70916
1 changed files with 19 additions and 0 deletions

View File

@ -29,11 +29,19 @@
#define TR_N_ELEMENTS( ary ) ( sizeof( ary ) / sizeof( *ary ) )
#if 0
#define dbgmsg(fmt, ...) \
do { \
fprintf( stderr, "%s:%d"#fmt, __FILE__, __LINE__, __VA_ARGS__ ); \
fprintf( stderr, "\n" ); \
} while( 0 )
#else
#define dbgmsg( ... ) \
do { \
if( tr_deepLoggingIsActive( ) ) \
tr_deepLog( __FILE__, __LINE__, "RPC", __VA_ARGS__ ); \
} while( 0 )
#endif
/***
@ -921,6 +929,14 @@ methods[] =
{ "torrent-verify", TRUE, torrentVerify }
};
static void
noop_response_callback( tr_session * session UNUSED,
const char * response UNUSED,
size_t response_len UNUSED,
void * user_data UNUSED )
{
}
static void
request_exec( tr_session * session,
tr_benc * request,
@ -932,6 +948,9 @@ request_exec( tr_session * session,
tr_benc * args_in = tr_bencDictFind( request, "arguments" );
const char * result = NULL;
if( callback == NULL )
callback = noop_response_callback;
/* parse the request */
if( !tr_bencDictFindStr( request, "method", &str ) )
result = "no method name";