From 91ace413455f975daa09d0acd4627f4e8ded90a5 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sat, 14 Oct 2017 11:52:35 +0300 Subject: [PATCH] [www] Fixed an issue with 500 error on undefined article --- src/routes/articles.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/articles.js b/src/routes/articles.js index 651c9712..32f6f8e6 100644 --- a/src/routes/articles.js +++ b/src/routes/articles.js @@ -142,12 +142,12 @@ function getArticle() { const path = getPathWithNoTrailingSlash(ctx.path) const article = await findArticle(id) - const previewId = article.preview - ? article.preview - : article.images[0] - article.preview = await Image.findById(previewId) - if (article) { + const previewId = article.preview + ? article.preview + : article.images[0] + article.preview = await Image.findById(previewId) + const Component = (