From 98223df18cdd76fa6c356ba5d5ae05dcbd04c689 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 ddd69f3ae968f67a892caaf8a953c31f1dbf550c 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 9cb2307fda..4e85e3c581 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 976cdefc0a..cc60a0d2eb 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) {