From 35cd44c563ec58e00a89109ef1f5450b08a3faa6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 23 Apr 2023 14:53:11 +0100 Subject: 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. --- misc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'misc.c') diff --git a/misc.c b/misc.c index f0c4abd..5621597 100644 --- a/misc.c +++ b/misc.c @@ -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; -- cgit v1.1