shithub: puzzles

Download patch

ref: 35cd44c563ec58e00a89109ef1f5450b08a3faa6
parent: 5c0def1850b2c09af300f09cd48f714f2505d217
author: Simon Tatham <anakin@pobox.com>
date: Sun Apr 23 10:53:11 EDT 2023

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.

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