From 7840c6b75b61e64d89d7fd9f291277fb177e513f Mon Sep 17 00:00:00 2001
From: Aleks Xhuvani <34059898+thehydrogen@users.noreply.github.com>
Date: Thu, 9 Nov 2023 23:35:53 +0100
Subject: [PATCH] Do not try to update an undefined video element (#27798)

---
 app/javascript/mastodon/features/video/index.jsx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/javascript/mastodon/features/video/index.jsx b/app/javascript/mastodon/features/video/index.jsx
index f88e9042e..bef14ea27 100644
--- a/app/javascript/mastodon/features/video/index.jsx
+++ b/app/javascript/mastodon/features/video/index.jsx
@@ -469,6 +469,10 @@ class Video extends PureComponent {
   };
 
   _syncVideoToVolumeState = (volume = null, muted = null) => {
+    if (!this.video) {
+      return;
+    }
+
     this.video.volume = volume ?? this.state.volume;
     this.video.muted = muted ?? this.state.muted;
   };