Merge pull request #255 from gabe565/patch-1

Image directory randomization can go out of bounds
This commit is contained in:
Dylan Araps 2016-05-17 17:04:12 +10:00
commit b5ecdff6e3
1 changed files with 1 additions and 1 deletions

View File

@ -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