From 7a1f709d90da1669b64461926050fcead979107b Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 3 Sep 2017 17:06:19 +0200 Subject: [PATCH] Small changed that first checks if the variable is undefined or not and then length --- seasoned_api/src/webserver/controllers/tmdb/searchMedia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seasoned_api/src/webserver/controllers/tmdb/searchMedia.js b/seasoned_api/src/webserver/controllers/tmdb/searchMedia.js index f09b859..90f5cda 100644 --- a/seasoned_api/src/webserver/controllers/tmdb/searchMedia.js +++ b/seasoned_api/src/webserver/controllers/tmdb/searchMedia.js @@ -14,7 +14,7 @@ function searchMoviesController(req, res) { Promise.resolve() .then(() => tmdb.search(query, page, type)) .then((movies) => { - if (movies.length > 0) { + if (movies !== undefined || movies.length > 0) { res.send(movies); } else { res.status(404).send({ success: false, error: 'Search query did not return any results.'})