twitchdev / twitch-cli

The official Twitch CLI to make developing on Twitch easier.
Apache License 2.0
604 stars 71 forks source link

[Bug] Cannot use CLI against Get Extension Live Channels without extension_id #232

Closed Xemdo closed 1 year ago

Xemdo commented 1 year ago

What is the problem?

Somewhat similar to #157

Running twitch api get extensions/live with only user_id and not extension_id panics and fails.

Operating System

All

Architecture Version (x86, x64, arm, etc)

All

Steps to reproduce

  1. twitch api get extensions/live -q user_id=57047445

Relevant log output

> twitch api get extensions/live -q user_id=57047445
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x803ea9]

goroutine 1 [running]:
github.com/twitchdev/twitch-cli/internal/api.NewRequest({0xb0de17, 0x3}, {0xc00015dcc0, 0x10}, {0xc000207000, 0x1, 0xc000223600?}, {0xfccdd0, 0x0, 0x0}, ...)
        /home/marc/shared/twitch-cli/internal/api/api.go:120 +0x6e9
github.com/twitchdev/twitch-cli/cmd.cmdRun(0xf531c0?, {0xc000202bd0?, 0x3?, 0x3?})
        /home/marc/shared/twitch-cli/cmd/api.go:127 +0x2b0
github.com/spf13/cobra.(*Command).execute(0xf531c0, {0xc000202ba0, 0x3, 0x3})
        /home/marc/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xf54340)
        /home/marc/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
        /home/marc/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
github.com/twitchdev/twitch-cli/cmd.Execute()
        /home/marc/shared/twitch-cli/cmd/root.go:26 +0x25
main.main()
        /home/marc/shared/twitch-cli/main.go:54 +0x2b6