aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-25 14:06:48 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-25 14:06:48 -1000
commitcae620df7c1340cf817c83ae5f21de1592964de4 (patch)
treef4771e99414a556e6927a77280acdfb587d09eab
parent54db98a9cf71d5f79379ab83c12474a688f0d5ae (diff)
downloadpatchfoo-cae620df7c1340cf817c83ae5f21de1592964de4.tar.gz
patchfoo-cae620df7c1340cf817c83ae5f21de1592964de4.zip
about-diff: handle initial diff
-rw-r--r--lib/serve.js10
1 files 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(