From d6fa03d9e655ae67fd3c63fb15698dc739d51050 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Tue, 15 Oct 2024 10:31:37 +0800 Subject: [PATCH] Fastfetch: don't use invalid paths when printing preset files --- src/fastfetch.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fastfetch.c b/src/fastfetch.c index 23a00611d..8be2ab211 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -266,10 +266,13 @@ static void listAvailablePresets(bool pretty) ffListFilesRecursively(path->chars, pretty); } - FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateCopy(&instance.state.platform.exePath); - ffStrbufSubstrBeforeLastC(&absolutePath, '/'); - ffStrbufAppendS(&absolutePath, "/presets/"); - ffListFilesRecursively(absolutePath.chars, pretty); + if (instance.state.platform.exePath.length) + { + FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateCopy(&instance.state.platform.exePath); + ffStrbufSubstrBeforeLastC(&absolutePath, '/'); + ffStrbufAppendS(&absolutePath, "/presets/"); + ffListFilesRecursively(absolutePath.chars, pretty); + } } static void listAvailableLogos(void)