phrase / phrase-cli

CLI for the Phrase API
https://developers.phrase.com
MIT License
42 stars 6 forks source link

Segfault on some branch names #80

Closed ThisIsMissEm closed 3 years ago

ThisIsMissEm commented 3 years ago

Hi! We're using the branches option when pushing and just had a PR cause the phrase-cli in our CI to segfault:

Please consider updating the Phrase CLI client (2.0.26 < 2.1.6)
You can get the latest version from https://phrase.com/cli.

Waiting for branch dependabot/npm_and_yarn/url-parse-1.5.1 is created! -\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x7fec5a]

goroutine 56 [running]:
github.com/phrase/phrase-go.(*APIResponse).populatePageValues(0xc000827360)
    /go/pkg/mod/github.com/phrase/phrase-go@v1.0.18/response.go:82 +0x3a
github.com/phrase/phrase-go.NewAPIResponse(0x0, 0xc000334100)
    /go/pkg/mod/github.com/phrase/phrase-go@v1.0.18/response.go:142 +0x59
github.com/phrase/phrase-go.(*APIClient).callAPI(0xc00028eea0, 0xc000334100, 0xc000998240, 0xc0000d4280, 0x78)
    /go/pkg/mod/github.com/phrase/phrase-go@v1.0.18/client.go:260 +0x77
github.com/phrase/phrase-go.(*BranchesApiService).BranchShow(0xc00028eea8, 0xc1b2c0, 0xc000998240, 0xc0002b44a0, 0x20, 0xc00013c3c0, 0x27, 0x0, 0x0, 0x0, ...)
    /go/pkg/mod/github.com/phrase/phrase-go@v1.0.18/api_branches.go:475 +0x4d4
github.com/phrase/phrase-cli/cmd/internal.getBranchCreateResult(0xc00028eea0, 0xc0002b44a0, 0x20, 0xc0000c6680, 0x300000000b450e0, 0xc00046a7a8, 0xc00046a7a8, 0x6bc378)
    /go/src/github.com/phrase/phrase-cli/cmd/internal/push.go:406 +0x1bc
github.com/phrase/phrase-cli/cmd/internal.(*PushCommand).Run.func1()
    /go/src/github.com/phrase/phrase-cli/cmd/internal/push.go:100 +0x79
github.com/phrase/phrase-cli/cmd/internal/spinner.While.func1(0xc000828180, 0xc000510000)
    /go/src/github.com/phrase/phrase-cli/cmd/internal/spinner/spinner.go:14 +0x4f
created by github.com/phrase/phrase-cli/cmd/internal/spinner.While
    /go/src/github.com/phrase/phrase-cli/cmd/internal/spinner/spinner.go:12 +0x67

I'm not sure if this is fixed in versions later than 2.0.26, but I'll be trying an update shortly.

ThisIsMissEm commented 3 years ago

Appears to be fixed in 2.1.6, though I couldn't see why based on the changelog (the push succeeded though)