[Glitch] Fix media modal crashing when media has no blurhash

Port c3d62dcf8a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Eugen Rochko 2020-11-28 03:37:01 +01:00 committed by Claire
parent e2e02e3a6b
commit 54803a7866
1 changed files with 5 additions and 2 deletions

View File

@ -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 () {