about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-07-15 21:07:53 +0200
committerThibaut Girka <thib@sitedethib.com>2020-07-16 14:44:53 +0200
commitf94cb947671add34feb13d8d85a67260d2f699a9 (patch)
tree4bfd6ec330f01a7187dd643d709eda81137c40a7 /app
parent1c6c40d17c233171c6252503df10da72fd039cf6 (diff)
[Glitch] Fix error when closing a playing audio or video modal
Port bfed7dd5f3127f08ece3070bd67f5737933bac1a to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app')
-rw-r--r--app/javascript/flavours/glitch/features/audio/index.js2
-rw-r--r--app/javascript/flavours/glitch/features/video/index.js2
2 files changed, 4 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/audio/index.js b/app/javascript/flavours/glitch/features/audio/index.js
index 9cb2307fd..4e85e3c58 100644
--- a/app/javascript/flavours/glitch/features/audio/index.js
+++ b/app/javascript/flavours/glitch/features/audio/index.js
@@ -283,6 +283,8 @@ class Audio extends React.PureComponent {
 
   _renderCanvas () {
     requestAnimationFrame(() => {
+      if (!this.audio) return;
+
       this.handleTimeUpdate();
       this._clear();
       this._draw();
diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js
index 976cdefc0..cc60a0d2e 100644
--- a/app/javascript/flavours/glitch/features/video/index.js
+++ b/app/javascript/flavours/glitch/features/video/index.js
@@ -195,6 +195,8 @@ class Video extends React.PureComponent {
 
   _updateTime () {
     requestAnimationFrame(() => {
+      if (!this.video) return;
+
       this.handleTimeUpdate();
 
       if (!this.state.paused) {