(trunk libT) #3204 "crash in tr_torrentGetMagnetLink() when the torrent doesn't have a display name yet" -- fixed in trunk for 2.00

This commit is contained in:
Charles Kerr 2010-05-11 15:30:30 +00:00
parent 3ff784ad28
commit 6d9ac874d8
1 changed files with 7 additions and 2 deletions

View File

@ -306,14 +306,19 @@ tr_torrentGetMagnetLink( const tr_torrent * tor )
{
int i;
char * ret;
const char * name;
struct evbuffer * s;
assert( tr_isTorrent( tor ) );
s = evbuffer_new( );
evbuffer_add_printf( s, "magnet:?xt=urn:btih:%s", tor->info.hashString );
evbuffer_add_printf( s, "%s", "&dn=" );
tr_http_escape( s, tr_torrentName( tor ), -1, TRUE );
name = tr_torrentName( tor );
if( name && *name )
{
evbuffer_add_printf( s, "%s", "&dn=" );
tr_http_escape( s, tr_torrentName( tor ), -1, TRUE );
}
for( i=0; i<tor->info.trackerCount; ++i )
{
evbuffer_add_printf( s, "%s", "&tr=" );