Fix “Change subscribed languages” crashing in some situations (#19268)

This commit is contained in:
Claire 2022-10-03 02:56:12 +02:00 committed by GitHub
parent c55219efa8
commit 37eaa7fc01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,6 +78,10 @@ class SubscribedLanguagesModal extends ImmutablePureComponent {
const language = this.props.languages.find(language => language[0] === value); const language = this.props.languages.find(language => language[0] === value);
const checked = this.state.selectedLanguages.includes(value); const checked = this.state.selectedLanguages.includes(value);
if (!language) {
return null;
}
return ( return (
<Option <Option
key={value} key={value}
@ -105,7 +109,7 @@ class SubscribedLanguagesModal extends ImmutablePureComponent {
<p className='report-dialog-modal__lead'><FormattedMessage id='subscribed_languages.lead' defaultMessage='Only posts in selected languages will appear on your home and list timelines after the change. Select none to receive posts in all languages.' /></p> <p className='report-dialog-modal__lead'><FormattedMessage id='subscribed_languages.lead' defaultMessage='Only posts in selected languages will appear on your home and list timelines after the change. Select none to receive posts in all languages.' /></p>
<div> <div>
{availableLanguages.union(selectedLanguages).map(value => this.renderItem(value))} {availableLanguages.union(selectedLanguages).delete(null).map(value => this.renderItem(value))}
</div> </div>
<div className='flex-spacer' /> <div className='flex-spacer' />