Diff
1diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh
2index a98d0b714c4794bc9a7744108b2a66066bcc3fe2..7876f1c89e5580d8b57bd1fd2d3ae756bba36c80 100644
3--- a/plugins/emoji/emoji.plugin.zsh
4+++ b/plugins/emoji/emoji.plugin.zsh
5@@ -76,8 +76,6 @@ emoji_skintone[6]=$'\U1F3FF'
6 # These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
7 # namespace, and to allow adding additional group definitions at run time.
8 # The keys are the group names, and the values are whitespace-separated lists of emoji character names.
9-#
10-# These extra local arrays are used to allow more convenient formatting of the source code.
11
12 emoji_groups[fruits]="
13 tomato
14@@ -255,9 +253,10 @@ function random_emoji() {
15 if [[ -z "$group" || "$group" == "all" ]]; then
16 names=(${(k)emoji})
17 else
18- names=(${=emoji_groups[$group_name]})
19+ names=(${=emoji_groups[$group]})
20 fi
21- local list_size=$#names
22+ local list_size=${#names}
23+ [[ $list_size -eq 0 ]] && return 1
24 local random_index=$(( ( RANDOM % $list_size ) + 1 ))
25 local name=${names[$random_index]}
26 echo ${emoji[$name]}