(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:
parent
3ff784ad28
commit
6d9ac874d8
|
@ -306,14 +306,19 @@ tr_torrentGetMagnetLink( const tr_torrent * tor )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char * ret;
|
char * ret;
|
||||||
|
const char * name;
|
||||||
struct evbuffer * s;
|
struct evbuffer * s;
|
||||||
|
|
||||||
assert( tr_isTorrent( tor ) );
|
assert( tr_isTorrent( tor ) );
|
||||||
|
|
||||||
s = evbuffer_new( );
|
s = evbuffer_new( );
|
||||||
evbuffer_add_printf( s, "magnet:?xt=urn:btih:%s", tor->info.hashString );
|
evbuffer_add_printf( s, "magnet:?xt=urn:btih:%s", tor->info.hashString );
|
||||||
evbuffer_add_printf( s, "%s", "&dn=" );
|
name = tr_torrentName( tor );
|
||||||
tr_http_escape( s, tr_torrentName( tor ), -1, TRUE );
|
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 )
|
for( i=0; i<tor->info.trackerCount; ++i )
|
||||||
{
|
{
|
||||||
evbuffer_add_printf( s, "%s", "&tr=" );
|
evbuffer_add_printf( s, "%s", "&tr=" );
|
||||||
|
|
Loading…
Reference in New Issue