From 191fe25c32d4c59af8ce068f24f48dee38eb109a Mon Sep 17 00:00:00 2001 From: xuxinkun Date: Sat, 19 Oct 2019 11:11:52 +0800 Subject: [PATCH] fix bug to avoid `out of range` error. --- jsonpatch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonpatch.go b/jsonpatch.go index 3e69894..327342d 100644 --- a/jsonpatch.go +++ b/jsonpatch.go @@ -326,7 +326,7 @@ func backtrace(s, t []interface{}, p string, i int, j int, matrix [][]int) []Ope return append([]Operation{op}, backtrace(s, t, p, i-1, j-1, matrix)...) } - p2, _ := handleValues(s[j-1], t[j-1], makePath(p, i-1), []Operation{}) + p2, _ := handleValues(s[i-1], t[j-1], makePath(p, i-1), []Operation{}) return append(p2, backtrace(s, t, p, i-1, j-1, matrix)...) } if i > 0 && j > 0 && matrix[i-1][j-1] == matrix[i][j] {