[www] Fixed an issue with 500 error on undefined article

This commit is contained in:
Roman Timashev committed 2017-10-14 11:52:35 +03:00
1 parent 892e270c99
commit 91ace41345
1 file changed
+5 -5
+5 -5
View File
@@ -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 = (
<div className="content content_thin">
<Article