fix: check if window is not null before invoking method

This commit is contained in:
Jelle Glebbeek
2021-06-15 02:35:47 +02:00
parent 769e5be37f
commit da5ea2086f

View File

@@ -82,7 +82,19 @@ class QueryManager {
totalFormats.sort((a, b) => b.height - a.height || b.fps - a.fps);
const title = initialQuery.title == null ? url : initialQuery.title;
const uploader = initialQuery.uploader == null ? "Unknown" : initialQuery.uploader;
this.window.webContents.send("videoAction", {action: "setUnified", identifier: playlistVideo.identifier,formats: totalFormats, subtitles: this.environment.mainDownloadSubs, thumb: videos[0].thumbnail, title: title, length: videos.length, uploader: uploader, url: playlistVideo.url})
if(this.window != null) {
this.window.webContents.send("videoAction", {
action: "setUnified",
identifier: playlistVideo.identifier,
formats: totalFormats,
subtitles: this.environment.mainDownloadSubs,
thumb: videos[0].thumbnail,
title: title,
length: videos.length,
uploader: uploader,
url: playlistVideo.url
})
}
} else {
this.removeVideo(playlistVideo);
for (const video of videos) {