Commit c6a5f6ef authored by Marc Cornellà's avatar Marc Cornellà
Browse files

Check that list_size value is not zero before division

parent 88243b84
...@@ -257,7 +257,8 @@ function random_emoji() { ...@@ -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]}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment