cli
cli copied to clipboard
Got golang panic when pushing message with --token parameter
I'd like to use gotify-cli in some automatic scripts invoked by some other services. When I tried to make a parameter settings like these and without the cli.json:
gotify-cli push --url http://gotify.xxxxxxxx.com --token someToken messages
I got a golang panic both on Linux and Windows:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xd8ea02]
goroutine 1 [running]:
github.com/gotify/cli/v2/command.doPush(0xc00079e2c0)
/home/jm/src/gotify/cli/command/push.go:72 +0x342
gopkg.in/urfave/cli%2ev1.HandleAction({0xdc0020, 0xe66ce0}, 0x4)
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:492 +0x7b
gopkg.in/urfave/cli%2ev1.Command.Run({{0xe3fecd, 0x4}, {0x0, 0x0}, {0xc0003f06e0, 0x1, 0x1}, {0xe4573b, 0x10}, {0x0, ...}, ...}, ...)
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/command.go:210 +0x8f8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00040f1e0, {0xc0000d8000, 0x7, 0x8})
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:255 +0x6ac
main.main()
/home/jm/src/gotify/cli/cli.go:34 +0xf88
But if I run gotify-cli init or create a cli.json file with same url and token, it works well.
I think there is some problem in setting default value of priority when giving the parameters' values in cli.json directly.
If I set the --priority parameter, it works well. But the priority has been claimed that it has a default value with 0.
Good catch. I'm open for PRs for this bug.