From b6d9e7d24f8e974749c41d8eaa7e21273548ff7f Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 12 Jun 2024 22:03:41 +0000 Subject: [PATCH] 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. --- thumbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thumbs.c b/thumbs.c index c7b9dc6..d91405e 100644 --- a/thumbs.c +++ b/thumbs.c @@ -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); cache_tmpfile_base = cache_tmpfile + len - 1; } else { - error(0, 0, "Cache directory not found"); + error(EXIT_FAILURE, 0, "Cache directory not found"); } }