Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Fails on empty lists or objects #13

Open
bastianbowe2000 opened this issue Mar 28, 2019 · 2 comments
Open

Fails on empty lists or objects #13

bastianbowe2000 opened this issue Mar 28, 2019 · 2 comments

Comments

@bastianbowe2000
Copy link

$ echo '{}'|jiq
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/fiatjaf/jiq.(*Engine).makeCandidates(0xc4200ae000)
	/home/babowe/go/src/github.com/fiatjaf/jiq/engine.go:195 +0x56c
github.com/fiatjaf/jiq.(*Engine).Run(0xc4200ae000, 0x0)
	/home/babowe/go/src/github.com/fiatjaf/jiq/engine.go:70 +0x13e
main.run(0xc4200ae000, 0xc42000c000, 0xc42000e1b0)
	/home/babowe/go/src/github.com/fiatjaf/jiq/cmd/jiq/jiq.go:53 +0x2f
main.main()
	/home/babowe/go/src/github.com/fiatjaf/jiq/cmd/jiq/jiq.go:49 +0x22f
@aesyondu
Copy link

$ echo '[]' | jiq

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/fiatjaf/jiq.(*Engine).makeCandidates(0xc0000d2000)
	/Users/aes/go/src/github.com/fiatjaf/jiq/engine.go:201 +0x560
github.com/fiatjaf/jiq.(*Engine).Run(0xc0000d2000, 0x0)
	/Users/aes/go/src/github.com/fiatjaf/jiq/engine.go:70 +0x118
main.run(0xc0000d2000, 0xc00008c000, 0xc000092010)
	/Users/aes/go/src/github.com/fiatjaf/jiq/cmd/jiq/jiq.go:53 +0x32
main.main()
	/Users/aes/go/src/github.com/fiatjaf/jiq/cmd/jiq/jiq.go:49 +0x14b

I guess fixing this simple bug would be a good excuse to learn go?

@fiatjaf
Copy link
Owner

fiatjaf commented Mar 16, 2020

Probably not, too irrelevant, and yet confusing.

Fixed in b24f06f

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants