]> granicus.if.org Git - transmission/commitdiff
(trunk) #3478 "Display bug when magnet links without display names are added" --...
authorCharles Kerr <charles@transmissionbt.com>
Tue, 3 Aug 2010 03:16:21 +0000 (03:16 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Tue, 3 Aug 2010 03:16:21 +0000 (03:16 +0000)
gtk/tr-core.c
libtransmission/metainfo.c

index ef1f5a94b0063c9d9a0c94a3c7d3e03be0fa6ebf..52e2114a88e74c3980a842554b8e4ae1fc0cf7da 100644 (file)
@@ -362,7 +362,7 @@ compareByName( GtkTreeModel *             model,
 
     gtk_tree_model_get( model, a, MC_NAME_COLLATED, &ca, -1 );
     gtk_tree_model_get( model, b, MC_NAME_COLLATED, &cb, -1 );
-    ret = strcmp( ca, cb );
+    ret = gtr_strcmp0( ca, cb );
 
     g_free( cb );
     g_free( ca );
@@ -893,11 +893,11 @@ tr_core_add_torrent( TrCore     * self,
 {
     const tr_info * inf = tr_torrent_info( gtor );
     const tr_stat * st = tr_torrent_stat( gtor );
-    tr_torrent *    tor = tr_torrent_handle( gtor );
-    char *          collated = g_utf8_strdown( inf->name, -1 );
-    char *          trackers = torrentTrackerString( tor );
+    tr_torrent * tor = tr_torrent_handle( gtor );
+    char *  collated = g_utf8_strdown( inf->name ? inf->name : "", -1 );
+    char *  trackers = torrentTrackerString( tor );
     GtkListStore *  store = GTK_LIST_STORE( tr_core_model( self ) );
-    GtkTreeIter     unused;
+    GtkTreeIter  unused;
 
     gtk_list_store_insert_with_values( store, &unused, 0,
                                        MC_NAME,          inf->name,
index 352646ecdb783052bba122e89257a35700d444b7..7b33241c1ce99e93b6345e3cfdd5d602fe88649e 100644 (file)
@@ -438,10 +438,14 @@ tr_metainfoParseImpl( const tr_session  * session,
             escape( inf->hashEscaped, inf->hash, SHA_DIGEST_LENGTH );
 
             /* maybe get the display name */
+          
             if( tr_bencDictFindStr( d, "display-name", &str ) ) {
                 tr_free( inf->name );
                 inf->name = tr_strdup( str );
             }
+
+            if( !inf->name )
+                inf->name = tr_strdup( inf->hashString );
         }
         else /* not a magnet link and has no info dict... */
         {