about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/subscribed_languages_modal/index.js
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-03 02:56:12 +0200
committerGitHub <noreply@github.com>2022-10-03 02:56:12 +0200
commit37eaa7fc01d8e9cbd06a62cc9ac4b3bd4d835240 (patch)
tree6cb5c5e5127f8ee81b039961518bedf31d0c7266 /app/javascript/mastodon/features/subscribed_languages_modal/index.js
parentc55219efa811b3c6347774bec1b174d325e5f300 (diff)
Fix “Change subscribed languages” crashing in some situations (#19268)
Diffstat (limited to 'app/javascript/mastodon/features/subscribed_languages_modal/index.js')
-rw-r--r--app/javascript/mastodon/features/subscribed_languages_modal/index.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/subscribed_languages_modal/index.js b/app/javascript/mastodon/features/subscribed_languages_modal/index.js
index 6a1bb2c47..a519ceabc 100644
--- a/app/javascript/mastodon/features/subscribed_languages_modal/index.js
+++ b/app/javascript/mastodon/features/subscribed_languages_modal/index.js
@@ -78,6 +78,10 @@ class SubscribedLanguagesModal extends ImmutablePureComponent {
     const language = this.props.languages.find(language => language[0] === value);
     const checked = this.state.selectedLanguages.includes(value);
 
+    if (!language) {
+      return null;
+    }
+
     return (
       <Option
         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>
 
           <div>
-            {availableLanguages.union(selectedLanguages).map(value => this.renderItem(value))}
+            {availableLanguages.union(selectedLanguages).delete(null).map(value => this.renderItem(value))}
           </div>
 
           <div className='flex-spacer' />