From c8d70c780c043ceb6af9601386f7c0b1963a2317 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 28 Dec 2018 10:53:28 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20apply=20text=20diff=20if=20an?= =?UTF-8?q?=20error=20occurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/diff/diff.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/diff/diff.go b/util/diff/diff.go index dea5ba95..94d8e81c 100644 --- a/util/diff/diff.go +++ b/util/diff/diff.go @@ -239,9 +239,10 @@ func (o *operations) patch(old map[string]interface{}) (now map[string]interface case "change": if txt, ok := obj.Get(path...).Data().(string); ok { dmp := diffmatchpatch.New() - dif, _ := dmp.DiffFromDelta(txt, v.value.(string)) - str := dmp.DiffText2(dif) - obj.Set(str, path...) + if dif, err := dmp.DiffFromDelta(txt, v.value.(string)); err == nil { + str := dmp.DiffText2(dif) + obj.Set(str, path...) + } } }