Commit 88243b84 authored by Marc Cornellà's avatar Marc Cornellà
Browse files

Use right variable name to avoid zero-length array

This fixes the typographic error that always assigned an undefined
array to `$names`, which made `$list_size` = 0 and triggered a
divide by zero error on the next line.
parent 192de6bc
...@@ -255,7 +255,7 @@ function random_emoji() { ...@@ -255,7 +255,7 @@ function random_emoji() {
if [[ -z "$group" || "$group" == "all" ]]; then if [[ -z "$group" || "$group" == "all" ]]; then
names=(${(k)emoji}) names=(${(k)emoji})
else else
names=(${=emoji_groups[$group_name]}) names=(${=emoji_groups[$group]})
fi fi
local list_size=$#names local list_size=$#names
local random_index=$(( ( RANDOM % $list_size ) + 1 )) local random_index=$(( ( RANDOM % $list_size ) + 1 ))
......
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