make_prefs_path(): tolerate NULL inputs.

Just noticed that if prefs_dir() returns NULL, we'll already have
passed it to this function before the calling functions get round to
checking. I think it's less wordy all round to make this helper
function propagate NULL than to mess about with lots of extra if
statements in between all the calls.
This commit is contained in:
Simon Tatham
2023-04-23 14:53:11 +01:00
parent 5c0def1850
commit 35cd44c563

3
misc.c
View File

@ -511,6 +511,9 @@ char *make_prefs_path(const char *dir, const char *sep,
char *path, *p;
const char *q;
if (!dir || !sep || !game || !suffix)
return NULL;
path = snewn(dirlen + seplen + gamelen + suffixlen + 1, char);
p = path;