From ea36d0f294344d668748f3b73d37d86239758086 Mon Sep 17 00:00:00 2001
From: Claire
Date: Sun, 2 Oct 2022 19:48:24 +0200
Subject: [PATCH] =?UTF-8?q?Fix=20=E2=80=9CChange=20subscribed=20languages?=
=?UTF-8?q?=E2=80=9D=20crashing=20in=20some=20situations?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../glitch/features/subscribed_languages_modal/index.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js b/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js
index 55404c184c..3047b434c8 100644
--- a/app/javascript/flavours/glitch/features/subscribed_languages_modal/index.js
+++ b/app/javascript/flavours/glitch/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))}