From bdac13b636e2d5a12b3176d14dfbc6b9230c1716 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 2 Dec 2013 17:44:40 -0500 Subject: [PATCH] FIX: If there are no featured topics in a category, don't fail. --- app/assets/javascripts/discourse/models/category.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index 7c68c9950..ae164682e 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -111,7 +111,10 @@ Discourse.Category = Discourse.Model.extend({ }.property(), latestTopic: function(){ - return this.get("topics")[0]; + var topics = this.get('topics'); + if (topics && topics.length) { + return topics[0] + } }.property("topics"), topicTrackingState: function(){