mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user