Fix misleading logged error if just "youtube.com" pasted in chat

This commit is contained in:
benji7425 2017-09-20 00:55:23 +01:00
parent 265f81197c
commit ed427fe3b2
1 changed files with 1 additions and 1 deletions

View File

@ -82,7 +82,7 @@ function normaliseUrl(url) {
const parsedUrl = Url.parse(url);
if (parsedUrl.host.includes("youtube.com")) {
const videoIDParam = parsedUrl.query.split("&").find(x => x.startsWith("v="));
const videoIDParam = (parsedUrl.query || "").split("&").find(x => x.startsWith("v="));
if (videoIDParam) {
const videoID = videoIDParam.substring(videoIDParam.indexOf("=") + 1, videoIDParam.length);
url = "http://youtu.be/" + videoID;