Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
c6a5f6ef
Commit
c6a5f6ef
authored
Aug 16, 2015
by
Marc Cornellà
Browse files
Check that list_size value is not zero before division
parent
88243b84
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/emoji/emoji.plugin.zsh
View file @
c6a5f6ef
...
@@ -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
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment