josephburnett / jd

JSON diff and patch
MIT License
1.62k stars 48 forks source link

Panic patching void node #27

Closed josephburnett closed 2 years ago

josephburnett commented 3 years ago
"runtime error: index out of range [0] with length 0" at:

 goroutine 6 [running]:
runtime/debug.Stack(0x45ba30, 0x34a80, 0x46afe0)
    /snap/go/current/src/runtime/debug/stack.go:24 +0x6
main.(*app).catchPanic(0x42a1e0)
    /home/joseph/jd/web/main.go:348 +0x5
panic(0x34a80, 0x46afe0)
    /snap/go/current/src/runtime/panic.go:969 +0x19
github.com/josephburnett/jd/lib.voidNode.patch(0x20cb80, 0x0, 0x0, 0x49d420, 0x7, 0x7, 0x498da0, 0x1, 0x1, 0x498dc0, ...)
    /home/joseph/jd/lib/void.go:65 +0x21
github.com/josephburnett/jd/lib.patchAll(0x710c0, 0x20cb80, 0x446240, 0x2, 0x2, 0x7ff8000100000050, 0x41b950, 0x7ff8000100000050, 0x41b950)
    /home/joseph/jd/lib/patch_common.go:10 +0x8
github.com/josephburnett/jd/lib.jsonObject.Patch(...)
    /home/joseph/jd/lib/object.go:179
main.(*app).printPatch(0x42a1e0)
    /home/joseph/jd/web/main.go:314 +0x2a
main.(*app).reconcile(0x42a1e0)
    /home/joseph/jd/web/main.go:156 +0xe
main.(*app).handleChange(0x42a1e0)
    /home/joseph/jd/web/main.go:139 +0x4
created by main.newApp
    /home/joseph/jd/web/main.go:98 +0x1d

Was testing with the inputs from #25 in the web UI

josephburnett commented 2 years ago

I haven’t seen a panic in a long time and I’ve been fuzzing pretty extensively

And there is a recover in the UI to catch panics and show instructions for submitting an issue. So I’ll close this one.