about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-07 22:12:11 +0200
committerThibG <thib@sitedethib.com>2019-05-07 22:33:37 +0200
commit2c767f44bf8d453bf118a0d131b1ca6e1187b96b (patch)
tree672a3b03b8e8c2471069de85add55c5a56e81793 /app/javascript/flavours/glitch
parent89d2859296bc5a57a8db07be86239cc938a3f691 (diff)
Fix front-end crash when a video has a blurhash and is hidden behind a CW
Diffstat (limited to 'app/javascript/flavours/glitch')
-rw-r--r--app/javascript/flavours/glitch/features/video/index.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js
index 8291ff3c8..2e0d59d47 100644
--- a/app/javascript/flavours/glitch/features/video/index.js
+++ b/app/javascript/flavours/glitch/features/video/index.js
@@ -166,6 +166,10 @@ export default class Video extends React.PureComponent {
 
   setCanvasRef = c => {
     this.canvas = c;
+
+    if (c && this.props.blurhash) {
+      this._decode();
+    }
   }
 
   handleMouseDownRoot = e => {
@@ -310,6 +314,8 @@ export default class Video extends React.PureComponent {
   }
 
   _decode () {
+    if (!this.canvas) return;
+
     const hash   = this.props.blurhash;
     const pixels = decode(hash, 32, 32);