Closed sophiebits closed 1 year ago
While adding a reviewer with git spr update -r, I got a segfault:
git spr update -r
> github create 62 : Don't count or show non-worked weeks > github get assignable users panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x100a37ccc] goroutine 1 [running]: github.com/ejoffe/spr/github/githubclient.(*client).GetAssignableUsers(0x1400012cfd8, {0x100bf7990, 0x14000122000}) /Users/runner/work/spr/spr/github/githubclient/client.go:270 +0x20c github.com/ejoffe/spr/spr.(*stackediff).UpdatePullRequests(0x14000133080, {0x100bf7990, 0x14000122000}, {0x140002a25a0, 0x1, 0x1}, 0x0) /Users/runner/work/spr/spr/spr/spr.go:210 +0xcc8 main.main.func4(0x140001355c0) /Users/runner/work/spr/spr/cmd/spr/main.go:154 +0x160 github.com/urfave/cli/v2.(*Command).Run(0x1400029a900, 0x14000135340) /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x634 github.com/urfave/cli/v2.(*App).RunContext(0x140001fa820, {0x100bf7990, 0x14000122000}, {0x14000134040, 0x4, 0x4}) /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x760 github.com/urfave/cli/v2.(*App).Run(...) /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224 main.main() /Users/runner/work/spr/spr/cmd/spr/main.go:223 +0x150c
Seems this is due to dereferencing the name here: https://github.com/ejoffe/spr/blob/867ff5dbd0b3ebe30c1ee4521c674fc184c5a900/github/githubclient/client.go#L270
Indeed, the GitHub user I tried to add does not have a name set, and I verified that the GitHub API actually returns this as null rather than an empty string!
null
Thank you for reporting the issue. Should be fixed in v11.2.
Thank you!
(Confirmed the fix works in real life – thanks again!)
While adding a reviewer with
git spr update -r
, I got a segfault:Seems this is due to dereferencing the name here: https://github.com/ejoffe/spr/blob/867ff5dbd0b3ebe30c1ee4521c674fc184c5a900/github/githubclient/client.go#L270
Indeed, the GitHub user I tried to add does not have a name set, and I verified that the GitHub API actually returns this as
null
rather than an empty string!