From 1b454c73ae07769d19c76828b972bd0525fa3769 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Wed, 13 Mar 2019 16:34:47 +0530 Subject: [PATCH] FIX: 'topic' can have null value --- Gemfile.lock | 2 +- .../javascripts/discourse/components/topic-status.js.es6 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 299c7f91ac8..1c78e4c7209 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -560,4 +560,4 @@ DEPENDENCIES webpush BUNDLED WITH - 1.17.3 + 2.0.1 diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6 index a3e47b75975..9e92561ea6f 100644 --- a/app/assets/javascripts/discourse/components/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-status.js.es6 @@ -32,8 +32,13 @@ export default Ember.Component.extend( buildBuffer(buffer) { const canAct = this.get("canAct"); + const topic = this.get("topic"); - TopicStatusIcons.render(this.get("topic"), function(name, key) { + if (!topic) { + return; + } + + TopicStatusIcons.render(topic, function(name, key) { const actionable = ["pinned", "unpinned"].includes(key) && canAct; const title = escapeExpression(I18n.t(`topic_statuses.${key}.help`)), startTag = actionable ? "a href" : "span",