mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-10-02 16:03:47 +02:00
Check that list_size value is not zero before division
This commit is contained in:
1 parent
88243b846a
commit
c6a5f6efb4
1 file changed
+2
-1
@@ -257,7 +257,8 @@ function random_emoji() {
|
||||
else
|
||||
names=(${=emoji_groups[$group]})
|
||||
fi
|
||||
local list_size=$#names
|
||||
local list_size=${#names}
|
||||
[[ $list_size -eq 0 ]] && return 1
|
||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||
local name=${names[$random_index]}
|
||||
echo ${emoji[$name]}
|
||||
|
||||
Reference in new issue
Block a user