From 6ee768b7b285382fce3270ad4cf06c71838182d8 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 55404c184..3047b434c 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))}