about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-11-28 03:37:01 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-05-07 22:47:09 +0200
commitcccc65651d0d9be444a473d8a86af912bbd8c772 (patch)
treeb063c887ffb5dddb820c68e7d27a6ff6873933fe /app/javascript/flavours/glitch/features/ui
parent9dde2400d0b79cb81e658f23e8c1864172928418 (diff)
[Glitch] Fix media modal crashing when media has no blurhash
Port 13206fcfb86844ba4a0c872eaf8c11a61ea848df to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/media_modal.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/media_modal.js b/app/javascript/flavours/glitch/features/ui/components/media_modal.js
index 7b07c557f..7290a914a 100644
--- a/app/javascript/flavours/glitch/features/ui/components/media_modal.js
+++ b/app/javascript/flavours/glitch/features/ui/components/media_modal.js
@@ -231,9 +231,12 @@ class MediaModal extends ImmutablePureComponent {
   _sendBackgroundColor () {
     const { media, onChangeBackgroundColor } = this.props;
     const index = this.getIndex();
-    const backgroundColor = decodeRGB(decode83(media.getIn([index, 'blurhash']).slice(2, 6)));
+    const blurhash = media.getIn([index, 'blurhash']);
 
-    onChangeBackgroundColor(backgroundColor);
+    if (blurhash) {
+      const backgroundColor = decodeRGB(decode83(blurhash.slice(2, 6)));
+      onChangeBackgroundColor(backgroundColor);
+    }
   }
 
   render () {