(trunk gtk) don't dereference a NULL pointer if a torrent has no "name"

This commit is contained in:
Charles Kerr
2010-02-06 05:21:25 +00:00
parent cee284549b
commit 40adcb5491
2 changed files with 10 additions and 6 deletions
+3 -3
View File
@@ -810,9 +810,9 @@ tr_core_session( TrCore * core )
static char*
doCollate( const char * in )
{
const char * end = in + strlen( in );
char * casefold;
char * ret;
char * ret;
char * casefold;
const char * end = in ? in + strlen( in ) : NULL;
while( in < end )
{
+7 -3
View File
@@ -389,9 +389,13 @@ checkFilterText( filter_text_mode_t filter_text_mode,
break;
default: /* NAME */
pch = g_utf8_casefold( inf->name, -1 );
ret = !text || ( strstr( pch, text ) != NULL );
g_free( pch );
if( !inf->name )
ret = TRUE;
else {
pch = g_utf8_casefold( inf->name, -1 );
ret = !text || ( strstr( pch, text ) != NULL );
g_free( pch );
}
break;
}