From ddd69f3ae968f67a892caaf8a953c31f1dbf550c Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 15 Jul 2020 21:07:53 +0200 Subject: [PATCH] Fix error when closing a playing audio or video modal (#14310) --- app/javascript/mastodon/features/audio/index.js | 2 ++ app/javascript/mastodon/features/video/index.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/javascript/mastodon/features/audio/index.js b/app/javascript/mastodon/features/audio/index.js index 2f85ebb7e3..1ab1c3117d 100644 --- a/app/javascript/mastodon/features/audio/index.js +++ b/app/javascript/mastodon/features/audio/index.js @@ -298,6 +298,8 @@ class Audio extends React.PureComponent { _renderCanvas () { requestAnimationFrame(() => { + if (!this.audio) return; + this.handleTimeUpdate(); this._clear(); this._draw(); diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index fb12567f0d..99dcdca221 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -182,6 +182,8 @@ class Video extends React.PureComponent { _updateTime () { requestAnimationFrame(() => { + if (!this.video) return; + this.handleTimeUpdate(); if (!this.state.paused) {