{
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;
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;