From cae620df7c1340cf817c83ae5f21de1592964de4 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 25 Jan 2019 14:06:48 -1000 Subject: about-diff: handle initial diff --- lib/serve.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/serve.js b/lib/serve.js index d87880c..f71e083 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -3936,17 +3936,17 @@ Serve.prototype.aboutDiff = function (url) { ? pull.values(['next: ', ph('a', {href: nextHref}, ph('code', nextMsg.key.substr(0, 8) + '…'))]) : pull.empty(), - prevMsg ? self.textEditDiffTable(prevMsg, msg) : pull.empty() + prevMsg || msg ? self.textEditDiffTable(prevMsg, msg) : pull.empty() ])) } } } Serve.prototype.textEditDiffTable = function (oldMsg, newMsg) { - var oldC = oldMsg.value.content || {} - var newC = newMsg.value.content || {} - var oldText = String(oldC.text || oldC.description) - var newText = String(newC.text || newC.description) + var oldC = oldMsg && oldMsg.value.content || {} + var newC = newMsg && newMsg.value.content || {} + var oldText = String(oldC.text || oldC.description || '') + var newText = String(newC.text || newC.description || '') var diff = Diff.structuredPatch('', '', oldText, newText) var self = this return pull( -- cgit v1.2.3