From 9a52096c9110bcfb53cfaed11216941f9efeec6f Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 4 Jan 2023 09:59:23 -0500 Subject: [PATCH] fix: assume no pkgs when dir is empty or does not exist --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index b6843349..74590eea 100755 --- a/neofetch +++ b/neofetch @@ -1807,7 +1807,7 @@ get_packages() { has() { type -p "$1" >/dev/null && manager=$1; } # globbing is intentional here # shellcheck disable=SC2206 - dir() { pkgs=($@); ((packages+=${#pkgs[@]})); pac "$((${#pkgs[@]}-pkgs_h))"; } + dir() { pkgs=($@); [[ ! -e ${pkgs[0]} ]] && return; ((packages+=${#pkgs[@]})); pac "$((${#pkgs[@]}-pkgs_h))"; } pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; } tot() { IFS=$'\n' read -d "" -ra pkgs <<< "$("$@")";