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.
This commit is contained in:
gabe565 2016-05-17 00:06:59 -05:00
parent a10843c945
commit 3b5938a631
1 changed files with 1 additions and 1 deletions

View File

@ -2158,7 +2158,7 @@ getimage () {
*) *)
if [ "${image: -1}" == "/" ]; then if [ "${image: -1}" == "/" ]; then
files=("$image"*.png "$image"*.jpg) files=("$image"*.png "$image"*.jpg)
img="$(printf "%s" "${files[RANDOM % ${#files[@]}]}")" img="$(printf "%s" "${files[RANDOM % (${#files[@]} - 1)]}")"
else else
img="$image" img="$image"
fi fi