From 07177a3d205ed1b9f65eeb599e1c770afaef7b30 Mon Sep 17 00:00:00 2001 From: gfx <86091021+gfxlabs@users.noreply.github.com> Date: Wed, 14 Sep 2022 20:48:33 -0500 Subject: [PATCH] Update arrays.go --- arrays.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arrays.go b/arrays.go index 3e4b507..3843808 100644 --- a/arrays.go +++ b/arrays.go @@ -43,7 +43,9 @@ func diffArrays(a, b []interface{}, p string) ([]*JSONPatchOperation, error) { break } if aIndex >= len(a) { // a is out of bounds, all new items in b must be adds - patch = append(patch, NewPatch("add", newPath, b[tmpIndex])) + if tmpIndex < len(b) { + patch = append(patch, NewPatch("add", newPath, b[tmpIndex])) + } addedDelta++ continue }