Avoid segfaults for empty param string
This commit is contained in:
parent
aa8825d9d8
commit
a94c066014
@ -168,6 +168,7 @@ int eea(
|
||||
|
||||
// params
|
||||
// allocate buffer for params
|
||||
if(params_string!=NULL) {
|
||||
char* params=calloc(sizeof(char), strlen(params_string)+1);
|
||||
strcpy(params, params_string);
|
||||
remove_entry(params, "starting_time");
|
||||
@ -175,6 +176,7 @@ int eea(
|
||||
remove_entry(params, "nsteps");
|
||||
fprintf(savefile," -p \"%s;starting_time=%lu;nsteps=%lu;init=file:%s\"", params, t+1, (nsteps == 0 ? 0 : nsteps-t-1), savefile_string);
|
||||
free(params);
|
||||
}
|
||||
|
||||
fprintf(savefile," energy\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user