From 784c7510d762f9c7206812abeade03d8f4afa611 Mon Sep 17 00:00:00 2001
From: unarist <m.unarist@gmail.com>
Date: Tue, 10 Oct 2017 22:17:53 +0900
Subject: [PATCH] Fix an error when video playback buffer is empty (#5300)

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

diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js
index 8b83fb66b..003bf23a8 100644
--- a/app/javascript/mastodon/features/video/index.js
+++ b/app/javascript/mastodon/features/video/index.js
@@ -210,7 +210,9 @@ export default class Video extends React.PureComponent {
   }
 
   handleProgress = () => {
-    this.setState({ buffer: this.video.buffered.end(0) / this.video.duration * 100 });
+    if (this.video.buffered.length > 0) {
+      this.setState({ buffer: this.video.buffered.end(0) / this.video.duration * 100 });
+    }
   }
 
   handleOpenVideo = () => {