FIX: In case called during a test

This commit is contained in:
Robin Ward 2016-11-23 10:41:02 -05:00
parent 652000a58b
commit 9fa384e1db
1 changed files with 6 additions and 3 deletions

View File

@ -145,9 +145,12 @@ function initializeWithApi(api) {
api.decorateWidget('post-contents:after-cooked', dec => {
if (dec.attrs.post_number === 1) {
const topic = dec.getModel().get('topic');
if (topic.get('accepted_answer')) {
return dec.rawHtml(`<p class="solved">${topic.get('acceptedAnswerHtml')}</p>`);
const postModel = dec.getModel();
if (postModel) {
const topic = postModel.get('topic');
if (topic.get('accepted_answer')) {
return dec.rawHtml(`<p class="solved">${topic.get('acceptedAnswerHtml')}</p>`);
}
}
}
});