mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-11 00:10:08 +00:00
Check that list_size value is not zero before division
This commit is contained in:
parent
88243b846a
commit
c6a5f6efb4
1 changed files with 2 additions and 1 deletions
|
@ -257,7 +257,8 @@ function random_emoji() {
|
||||||
else
|
else
|
||||||
names=(${=emoji_groups[$group]})
|
names=(${=emoji_groups[$group]})
|
||||||
fi
|
fi
|
||||||
local list_size=$#names
|
local list_size=${#names}
|
||||||
|
[[ $list_size -eq 0 ]] && return 1
|
||||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||||
local name=${names[$random_index]}
|
local name=${names[$random_index]}
|
||||||
echo ${emoji[$name]}
|
echo ${emoji[$name]}
|
||||||
|
|
Loading…
Reference in a new issue