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

Segfault on any request #50

Closed
mkhan45 opened this issue Jun 23, 2020 · 2 comments
Closed

Segfault on any request #50

mkhan45 opened this issue Jun 23, 2020 · 2 comments

Comments

@mkhan45
Copy link

mkhan45 commented Jun 23, 2020

When I try to use GetClips with a specified start time and end time, I get a segfault:

  startTime := time.Now().Add(time.Duration(-1) * time.Hour)
  endTime := time.Now()

  resp, err := twitchClient.GetClips(&helix.ClipsParams {
     BroadcasterID: accountID,
     First: 5,
     StartedAt: helix.Time{ Time: startTime },
     EndedAt: helix.Time{ Time: endTime },
  })

The same code works if I remove StartedAt and EndedAt.

Here's the error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x67753f]

goroutine 1 [running]:
github.com/nicklaw5/helix.(*Client).getBaseURL(0x94f500, 0x7061c4, 0x6, 0x6bf460, 0xc000169d90)
        /home/fish/go/pkg/mod/github.com/nicklaw5/helix@v0.5.9/helix.go:307 +0xff
github.com/nicklaw5/helix.(*Client).newRequest(0x94f500, 0x705c51, 0x3, 0x7061c4, 0x6, 0x695bc0, 0xc000102e70, 0x40e100, 0x20, 0x6bf460, ...)
        /home/fish/go/pkg/mod/github.com/nicklaw5/helix@v0.5.9/helix.go:253 +0x46
github.com/nicklaw5/helix.(*Client).sendRequest(0x94f500, 0x705c51, 0x3, 0x7061c4, 0x6, 0x695a80, 0xc0001103a0, 0x695bc0, 0xc000102e70, 0x40e100,
 ...)
        /home/fish/go/pkg/mod/github.com/nicklaw5/helix@v0.5.9/helix.go:158 +0xca
github.com/nicklaw5/helix.(*Client).get(...)
        /home/fish/go/pkg/mod/github.com/nicklaw5/helix@v0.5.9/helix.go:133
github.com/nicklaw5/helix.(*Client).GetUsers(0x94f500, 0xc000102e70, 0x2a, 0xc000169ed8, 0x40e198)
        /home/fish/go/pkg/mod/github.com/nicklaw5/helix@v0.5.9/users.go:42 +0xa0
main.get_user_id_from_username(0x706a7a, 0x8, 0x7083f0, 0xe)
        /home/fish/twitch-discord-bot/main.go:17 +0xa9
main.main()
        /home/fish/twitch-discord-bot/main.go:38 +0x145
exit status 2

@mkhan45
Copy link
Author

mkhan45 commented Jun 23, 2020

I goofed; I'm segfaulting no matter the request so I assume I did something wrong setupwise

@mkhan45 mkhan45 changed the title GetClips segfault with StartedAt Segfault on any request Jun 23, 2020
@mkhan45
Copy link
Author

mkhan45 commented Jun 23, 2020

Whoops, looks like this is my bad. I'd set up a global twitchClient *helix.Client and using it in bad ways

@mkhan45 mkhan45 closed this as completed Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant