Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got golang panic when pushing message with --token parameter #50

Closed
jerry-yuan opened this issue Jan 8, 2022 · 2 comments · Fixed by #61
Closed

Got golang panic when pushing message with --token parameter #50

jerry-yuan opened this issue Jan 8, 2022 · 2 comments · Fixed by #61
Labels
a:bug Something isn't working

Comments

@jerry-yuan
Copy link

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/cli.v1@v1.20.0/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/cli.v1@v1.20.0/command.go:210 +0x8f8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00040f1e0, {0xc0000d8000, 0x7, 0x8})
        /home/jm/go/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/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.

@jerry-yuan
Copy link
Author

jerry-yuan commented Jan 8, 2022

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.

@jmattheis jmattheis added the a:bug Something isn't working label Jan 8, 2022
@jmattheis
Copy link
Member

Good catch. I'm open for PRs for this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants