Closed norwnd closed 1 year ago
Seems like some error handling needs to be done more cautiously:
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1513e64] goroutine 562 [running]: github.com/kkdai/youtube/v2.(*Client).downloadChunk(0xc0000aa100?, 0xc0000aa700, 0xc000004fa8) /Users/norwnd/go/pkg/mod/github.com/kkdai/youtube/v2@v2.8.3/client.go:595 +0x404 github.com/kkdai/youtube/v2.(*Client).downloadChunked.func2() /Users/norwnd/go/pkg/mod/github.com/kkdai/youtube/v2@v2.8.3/client.go:412 +0x9c created by github.com/kkdai/youtube/v2.(*Client).downloadChunked /Users/norwnd/go/pkg/mod/github.com/kkdai/youtube/v2@v2.8.3/client.go:404 +0x287 exit status 2
while this particular panic results from the following block of code where resp is nil:
resp, err := c.httpDo(req) if err != nil { return ErrUnexpectedStatusCode(resp.StatusCode) }
there probably are other similar places in the code nearby to check.
Seems like some error handling needs to be done more cautiously:
while this particular panic results from the following block of code where resp is nil:
there probably are other similar places in the code nearby to check.