about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-07 22:18:05 +0100
committerGitHub <noreply@github.com>2019-03-07 22:18:05 +0100
commit75cb93676b1dd41d3e47f62466c0c6430691a990 (patch)
tree5432b6d3db1fc6c7728c8a96f68f2dd6009d059c /app/javascript
parentbe1c634b2b4372a525d304d2ff830392f04c5cc5 (diff)
Fix NaN in Poll component (#10213)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/poll.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js
index bfff7b601..a1b297ce7 100644
--- a/app/javascript/mastodon/components/poll.js
+++ b/app/javascript/mastodon/components/poll.js
@@ -94,7 +94,7 @@ class Poll extends ImmutablePureComponent {
 
   renderOption (option, optionIndex) {
     const { poll, disabled } = this.props;
-    const percent            = (option.get('votes_count') / poll.get('votes_count')) * 100;
+    const percent            = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
     const leading            = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count'));
     const active             = !!this.state.selected[`${optionIndex}`];
     const showResults        = poll.get('voted') || poll.get('expired');