]> cat aescling's git repositories - mastodon.git/commitdiff
Fix error when closing a playing audio or video modal (#14310)
authorThibG <thib@sitedethib.com>
Wed, 15 Jul 2020 19:07:53 +0000 (21:07 +0200)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2020 19:07:53 +0000 (21:07 +0200)
app/javascript/mastodon/features/audio/index.js
app/javascript/mastodon/features/video/index.js

index 2f85ebb7e3a9ac2cb96fbc1fee97a6930acbf17e..1ab1c3117d7cd47c1efdd286be53ee8d7466fb9e 100644 (file)
@@ -298,6 +298,8 @@ class Audio extends React.PureComponent {
 
   _renderCanvas () {
     requestAnimationFrame(() => {
+      if (!this.audio) return;
+
       this.handleTimeUpdate();
       this._clear();
       this._draw();
index fb12567f0d6af93f60ee5d586f2399483a1e909a..99dcdca2216321aacaaab112226f7b5c4e883c3b 100644 (file)
@@ -182,6 +182,8 @@ class Video extends React.PureComponent {
 
   _updateTime () {
     requestAnimationFrame(() => {
+      if (!this.video) return;
+
       this.handleTimeUpdate();
 
       if (!this.state.paused) {