Fixed story chapters being unresponsive if there are no comments.
the build was successful

This commit is contained in:
2019-03-17 21:44:07 +01:00
parent 06bf2b67a2
commit 853076fd5e
@@ -30,9 +30,11 @@ module.exports = class {
const comments = this.input.chapter.comments || []
const lastComment = comments[comments.length - 1]
let date = lastComment.fictionalDate || chapter.fictionalDate
if (date != null) {
this.change("fictionalDate", {target: {value: moment(date).format("MMM D, YYYY")}})
if (lastComment != null) {
let date = lastComment.fictionalDate || this.input.chapter.fictionalDate
if (date != null) {
this.change("fictionalDate", {target: {value: moment(date).format("MMM D, YYYY")}})
}
}
}