tr_ctorSetDownloadDir(): handle NULL download dirs more gracefully.

This commit is contained in:
Charles Kerr 2008-06-11 23:40:27 +00:00
parent 9c649d7752
commit a029f4e34a
1 changed files with 7 additions and 2 deletions

View File

@ -207,8 +207,13 @@ tr_ctorSetDownloadDir( tr_ctor * ctor,
const char * directory )
{
struct optional_args * args = &ctor->optionalArgs[mode];
args->isSet_downloadDir = 1;
tr_strlcpy( args->downloadDir, directory, sizeof( args->downloadDir ) );
if( directory ) {
args->isSet_downloadDir = 1;
tr_strlcpy( args->downloadDir, directory, sizeof( args->downloadDir ) );
} else {
args->isSet_downloadDir = 0;
*args->downloadDir = '\0';
}
}
int