diff --git a/controller/video.js b/controller/video.js index b2197d2..599bec1 100644 --- a/controller/video.js +++ b/controller/video.js @@ -35,6 +35,8 @@ exports.getVideo = async (req, res) => { exports.getChannel = async (req, res) => { const videos = await metadata.getChannelVideos(req.params.id) const channel = await metadata.getChannel(req.params.id) + + if (!videos || !channel) return res.json({ error: '500' }) if (videos.error) return res.json({ error: '404' }) const archived = await prisma.videos.findMany({ @@ -86,6 +88,8 @@ exports.getChannel = async (req, res) => { exports.getPlaylist = async (req, res) => { const playlist = await metadata.getPlaylistVideos(req.params.id) + + if (!playlist) return res.json({ error: '500' }) if (playlist.error) return res.json({ error: '404' }) const playlistArchived = await prisma.videos.findMany({