From: Pasi Kallinen Date: Fri, 6 Apr 2007 23:13:06 +0000 (+0000) Subject: Fix segfault when no mkdir or chdir defined X-Git-Tag: v1.6.1-roc-dev~347 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=f4a322f9965fb5593d80bf6192540ff887ee5fb4;p=dgamelaunch Fix segfault when no mkdir or chdir defined git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@358 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/dgamelaunch.c b/dgamelaunch.c index eaf3e68..15aeff2 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -1959,13 +1959,17 @@ main (int argc, char** argv) myconfig[userchoice]->bin_args[i] = tmp; } - tmp = strdup(dgl_format_str(userchoice, me, myconfig[userchoice]->mkdir)); - free(myconfig[userchoice]->mkdir); - myconfig[userchoice]->mkdir = tmp; + if (myconfig[userchoice]->mkdir) { + tmp = strdup(dgl_format_str(userchoice, me, myconfig[userchoice]->mkdir)); + free(myconfig[userchoice]->mkdir); + myconfig[userchoice]->mkdir = tmp; + } - tmp = strdup(dgl_format_str(userchoice, me, myconfig[userchoice]->chdir)); - free(myconfig[userchoice]->chdir); - myconfig[userchoice]->chdir = tmp; + if (myconfig[userchoice]->chdir) { + tmp = strdup(dgl_format_str(userchoice, me, myconfig[userchoice]->chdir)); + free(myconfig[userchoice]->chdir); + myconfig[userchoice]->chdir = tmp; + } /* launch program */ ttyrec_main (userchoice, me->username, gen_ttyrec_filename());