From 3b5938a63165b7102fda1529da5c1fa49142099d Mon Sep 17 00:00:00 2001
From: gabe565 <gabe565@users.noreply.github.com>
Date: Tue, 17 May 2016 00:06:59 -0500
Subject: [PATCH] Image directory randomization can go out of bounds

Need to subtract 1 from the total number of files in a directory or else sometimes it will have to fallback to ascii art.
---
 neofetch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/neofetch b/neofetch
index 2d5963ac..9ef4f89f 100755
--- a/neofetch
+++ b/neofetch
@@ -2158,7 +2158,7 @@ getimage () {
         *)
             if [ "${image: -1}" == "/" ]; then
                 files=("$image"*.png "$image"*.jpg)
-                img="$(printf "%s" "${files[RANDOM % ${#files[@]}]}")"
+                img="$(printf "%s" "${files[RANDOM % (${#files[@]} - 1)]}")"
             else
                 img="$image"
             fi