diff options
| author | Simon Tatham <anakin@pobox.com> | 2023-04-23 14:53:11 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2023-04-23 14:53:11 +0100 |
| commit | 35cd44c563ec58e00a89109ef1f5450b08a3faa6 (patch) | |
| tree | bc36661556f04dfe81c703faf69d9ab5112063f3 /misc.c | |
| parent | 5c0def1850b2c09af300f09cd48f714f2505d217 (diff) | |
| download | puzzles-35cd44c563ec58e00a89109ef1f5450b08a3faa6.zip puzzles-35cd44c563ec58e00a89109ef1f5450b08a3faa6.tar.gz puzzles-35cd44c563ec58e00a89109ef1f5450b08a3faa6.tar.bz2 puzzles-35cd44c563ec58e00a89109ef1f5450b08a3faa6.tar.xz | |
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.
Diffstat (limited to 'misc.c')
| -rw-r--r-- | misc.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |