From 37eaa7fc01d8e9cbd06a62cc9ac4b3bd4d835240 Mon Sep 17 00:00:00 2001
From: Claire
Date: Mon, 3 Oct 2022 02:56:12 +0200
Subject: [PATCH] =?UTF-8?q?Fix=20=E2=80=9CChange=20subscribed=20languages?=
=?UTF-8?q?=E2=80=9D=20crashing=20in=20some=20situations=20(#19268)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mastodon/features/subscribed_languages_modal/index.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/javascript/mastodon/features/subscribed_languages_modal/index.js b/app/javascript/mastodon/features/subscribed_languages_modal/index.js
index 6a1bb2c47f..a519ceabc5 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 (
- {availableLanguages.union(selectedLanguages).map(value => this.renderItem(value))}
+ {availableLanguages.union(selectedLanguages).delete(null).map(value => this.renderItem(value))}