From f4a322f9965fb5593d80bf6192540ff887ee5fb4 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 6 Apr 2007 23:13:06 +0000 Subject: [PATCH] Fix segfault when no mkdir or chdir defined git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@358 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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());