turnage / graw

Golang Reddit API Wrapper
MIT License
288 stars 49 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #57

Closed jb3 closed 4 years ago

jb3 commented 4 years ago

Indeed similar to #55 but I'm super confused as to what I'm doing wrong here, since as far as I can see I'm doing everything as normal.

Code is here: https://play.golang.org/p/vKbxsbNLSa9

I get the following error:

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

goroutine 1 [running]:
github.com/turnage/graw/reddit.(*appClient).authorize(0xc0000d0090, 0xc0000d0090, 0xc0001040b4)
    /Users/joseph/go/src/github.com/turnage/graw/reddit/appclient.go:59 +0x24a
github.com/turnage/graw/reddit.newAppClient(0xc00010600d, 0x2a, 0xc000106045, 0xf, 0xc000106066, 0x1b, 0xc00010608e, 0xa, 0xc0001060a5, 0xd, ...)
    /Users/joseph/go/src/github.com/turnage/graw/reddit/appclient.go:79 +0xff
github.com/turnage/graw/reddit.newClient(0xc00010600d, 0x2a, 0xc000106045, 0xf, 0xc000106066, 0x1b, 0xc00010608e, 0xa, 0xc0001060a5, 0xd, ...)
    /Users/joseph/go/src/github.com/turnage/graw/reddit/client.go:79 +0x15a
github.com/turnage/graw/reddit.NewBot(0xc00010600d, 0x2a, 0xc000106045, 0xf, 0xc000106066, 0x1b, 0xc00010608e, 0xa, 0xc0001060a5, 0xd, ...)
    /Users/joseph/go/src/github.com/turnage/graw/reddit/bot.go:38 +0xba
github.com/turnage/graw/reddit.NewBotFromAgentFile(0x13f7db3, 0xd, 0x0, 0xc000044e88, 0xa3d9af05b49f4c1d, 0x10, 0x13715e0)
    /Users/joseph/go/src/github.com/turnage/graw/reddit/bot.go:64 +0x156
main.main()
    /Users/joseph/golang-reddit/main.go:8 +0x54
exit status 2

Which seems to point back to it being an error in NewBotFromAgentFile but I'm not sure what I've done wrong.

turnage commented 4 years ago

Fixed in #61