Skip to content

Panic on Apply of op:test with non existing attribute #114

Closed

Description

@kolomnik

Hello,

I have tried to apply following patch:

[{"op":"test","path":"/missingAttr"}]

on json:

{"intAttr":10,"strAttr":"string"}

And it resulted in panic:
runtime error: invalid memory address or nil pointer dereference:

With stack:
/usr/local/go/src/runtime/panic.go:679
runtime.panicmem
/usr/local/go/src/runtime/panic.go:199
runtime.sigpanic
/usr/local/go/src/runtime/signal_unix.go:394
github.com/evanphx/json-patch.newLazyNode
.../go/pkg/mod/github.com/evanphx/[email protected]+incompatible/patch.go:61
github.com/evanphx/json-patch.Patch.ApplyIndent
.../go/pkg/mod/github.com/evanphx/[email protected]+incompatible/patch.go:752
github.com/evanphx/json-patch.Patch.Apply
.../go/pkg/mod/github.com/evanphx/[email protected]+incompatible/patch.go:718
cm-backend/server/api.processJsonPatch
....

Expectation was to see an error.

Activity

  1. danmx commented on Oct 28, 2023

    @danmx

    it seems it's fixed an can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions