[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
+1 -1
+1 -1
View File
@@ -142,12 +142,12 @@ function getArticle() {
const path = getPathWithNoTrailingSlash(ctx.path) const path = getPathWithNoTrailingSlash(ctx.path)
const article = await findArticle(id) const article = await findArticle(id)
if (article) {
const previewId = article.preview const previewId = article.preview
? article.preview ? article.preview
: article.images[0] : article.images[0]
article.preview = await Image.findById(previewId) article.preview = await Image.findById(previewId)
if (article) {
const Component = ( const Component = (
<div className="content content_thin"> <div className="content content_thin">
<Article <Article