fix a handful of console warnings that were generated by trying to trash a NULL .torrent file b/c the torrent had been added from a URL

This commit is contained in:
Jordan Lee 2012-09-23 15:38:07 +00:00
parent 36e1337e68
commit 33c4d25f19
2 changed files with 12 additions and 5 deletions

View File

@ -984,11 +984,14 @@ core_create_new_torrent( TrCore * core, tr_ctor * ctor )
{
const char * config = tr_sessionGetConfigDir( session );
const char * source = tr_ctorGetSourceFile( ctor );
const int is_internal = source && ( strstr( source, config ) == source );
/* #1294: don't delete the .torrent file if it's our internal copy */
if( !is_internal )
gtr_file_trash_or_remove( source );
if( source != NULL )
{
/* #1294: don't delete the .torrent file if it's our internal copy */
const int is_internal = ( strstr( source, config ) == source );
if( !is_internal )
gtr_file_trash_or_remove( source );
}
}
return tor;

View File

@ -299,8 +299,12 @@ on_tree_view_button_released( GtkWidget * view,
int
gtr_file_trash_or_remove( const char * filename )
{
GFile * file;
gboolean trashed = FALSE;
GFile * file = g_file_new_for_path( filename );
g_return_val_if_fail (filename && *filename, 0);
file = g_file_new_for_path( filename );
if( gtr_pref_flag_get( PREF_KEY_TRASH_CAN_ENABLED ) ) {
GError * err = NULL;