fix: crash when cache directory is not present

to reproduce:

	( unset HOME XDG_CACHE_HOME; nsxiv -t ~/pictures; )

the code never really worked without a cache_dir going back to
original sxiv. so just fatally error out instead of crashing
with a null pointer dereference.
This commit is contained in:
NRK 2024-06-12 22:03:41 +00:00
parent 36d5b27fff
commit b6d9e7d24f

View file

@ -181,7 +181,7 @@ void tns_init(tns_t *tns, fileinfo_t *tns_files, const int *cnt, int *sel, win_t
memcpy(cache_tmpfile, cache_dir, len - 1); memcpy(cache_tmpfile, cache_dir, len - 1);
cache_tmpfile_base = cache_tmpfile + len - 1; cache_tmpfile_base = cache_tmpfile + len - 1;
} else { } else {
error(0, 0, "Cache directory not found"); error(EXIT_FAILURE, 0, "Cache directory not found");
} }
} }