Browse Source

Fix error when closing a playing audio or video modal (#14310)

ThibG 3 years ago
parent
commit
bfed7dd5f3

+ 2 - 0
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();

+ 2 - 0
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) {