From bf0b07f3d7a801b3cf2e2a467fec1ec216875871 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 18 Dec 2021 17:15:53 +0700 Subject: [PATCH] fix error when restarting player with same video --- tubearchivist/static/script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 62f06aa..49218b0 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -349,7 +349,10 @@ function removePlayer() { if (playerElement.hasChildNodes()) { var youtubeId = playerElement.childNodes[0].getAttribute("data-id"); var playedStatus = document.createDocumentFragment(); - playedStatus.appendChild(document.getElementById(youtubeId)); + var playedBox = document.getElementById(youtubeId); + if (playedBox) { + playedStatus.appendChild(playedBox); + }; playerElement.innerHTML = ''; // append played status var videoInfo = document.getElementById('video-info-' + youtubeId);