File tree Expand file tree Collapse file tree
app/javascript/mastodon/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export default @injectIntl
4545class Poll extends ImmutablePureComponent {
4646
4747 static propTypes = {
48- poll : ImmutablePropTypes . map . isRequired ,
48+ poll : ImmutablePropTypes . map ,
4949 intl : PropTypes . object . isRequired ,
5050 dispatch : PropTypes . func ,
5151 disabled : PropTypes . bool ,
@@ -122,9 +122,14 @@ class Poll extends ImmutablePureComponent {
122122
123123 render ( ) {
124124 const { poll, intl } = this . props ;
125- const timeRemaining = timeRemainingString ( intl , new Date ( poll . get ( 'expires_at' ) ) , intl . now ( ) ) ;
126- const showResults = poll . get ( 'voted' ) || poll . get ( 'expired' ) ;
127- const disabled = this . props . disabled || Object . entries ( this . state . selected ) . every ( item => ! item ) ;
125+
126+ if ( ! poll ) {
127+ return null ;
128+ }
129+
130+ const timeRemaining = timeRemainingString ( intl , new Date ( poll . get ( 'expires_at' ) ) , intl . now ( ) ) ;
131+ const showResults = poll . get ( 'voted' ) || poll . get ( 'expired' ) ;
132+ const disabled = this . props . disabled || Object . entries ( this . state . selected ) . every ( item => ! item ) ;
128133
129134 return (
130135 < div className = 'poll' >
You can’t perform that action at this time.
0 commit comments