From f94cb947671add34feb13d8d85a67260d2f699a9 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 15 Jul 2020 21:07:53 +0200 Subject: [PATCH] [Glitch] Fix error when closing a playing audio or video modal Port bfed7dd5f3127f08ece3070bd67f5737933bac1a to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/audio/index.js | 2 ++ app/javascript/flavours/glitch/features/video/index.js | 2 ++ 2 files changed, 4 insertions(+) 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) {