Image: [Shuffle] Fixed issues with shuffle mode

This commit is contained in:
Dylan Araps 2017-01-15 09:44:56 +11:00
parent cbd6dfb899
commit a4fec94cc7
1 changed files with 3 additions and 1 deletions

View File

@ -2058,8 +2058,10 @@ get_image_source() {
*)
if [[ -d "$image_source" ]]; then
shopt -s nullglob
files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif})
printf -v image "%s" "${files[RANDOM % (${#files[@]} - 1)]}"
shopt -u nullglob
image="${files[RANDOM % ${#files[@]}]}"
else
image="$image_source"