crash fix

This commit is contained in:
barisusakli
2014-08-30 14:42:48 -04:00
parent 87c8cd2fb0
commit 537dea4e4b
3 changed files with 21 additions and 19 deletions

View File

@@ -70,7 +70,7 @@ topicsController.get = function(req, res, next) {
function (topicData, next) {
var description = '';
if(topicData.posts.length) {
if (topicData.posts[0] && topicData.posts[0].content) {
description = S(topicData.posts[0].content).stripTags().decodeHTMLEntities().s;
}
@@ -83,7 +83,7 @@ topicsController.get = function(req, res, next) {
var ogImageUrl = '';
if (topicData.thumb) {
ogImageUrl = topicData.thumb;
} else if(topicData.posts.length && topicData.posts[0].user && topicData.posts[0].user.picture){
} else if(topicData.posts.length && topicData.posts[0] && topicData.posts[0].user && topicData.posts[0].user.picture){
ogImageUrl = topicData.posts[0].user.picture;
} else if(meta.config['brand:logo']) {
ogImageUrl = meta.config['brand:logo'];