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

Add nil check for twitter description field #471

Merged
merged 2 commits into from Sep 19, 2022

Conversation

envomer
Copy link
Contributor

@envomer envomer commented Sep 18, 2022

Add a nil check for twitter description field. When executing FetchUser an interface conversion error is thrown when parsing the description field. This PR fixes that occurrence.

2022/09/18 23:55:28 http: panic serving [::1]:49881: interface conversion: interface {} is nil, not string
goroutine 9 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1825 +0xb0
panic({0x100ba35a0, 0x140004196e0})
        /usr/local/go/src/runtime/panic.go:844 +0x258
github.com/markbates/goth/providers/twitterv2.(*Provider).FetchUser(_, {_, _})
        /Users/omer/go/pkg/mod/github.com/markbates/goth@v1.73.0/providers/twitterv2/twitterv2.go:142 +0x6c4
github.com/markbates/goth/gothic.glob..func3({_, _}, _)
        /Users/omer/go/pkg/mod/github.com/markbates/goth@v1.73.0/gothic/gothic.go:215 +0x3cc
example.com/web.SocialEndpoints.func1({0x100c5d9c0?, 0x140001781c0}, 0x14000468000?, {0x3?, 0x14000178200?, 0x0?})
        /Users/omer/Code/example/web/social.go:215 +0x58
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0x140000b0b40, {0x100c5d9c0, 0x140001781c0}, 0x14000602000)
        /Users/omer/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387 +0x744
net/http.serverHandler.ServeHTTP({0x140003510e0?}, {0x100c5d9c0, 0x140001781c0}, 0x14000602000)
        /usr/local/go/src/net/http/server.go:2916 +0x3fc
net/http.(*conn).serve(0x140002670e0, {0x100c5e278, 0x14000350ff0})
        /usr/local/go/src/net/http/server.go:1966 +0x56c
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3071 +0x450

@envomer envomer changed the title Add null check for twitter description field Add nil check for twitter description field Sep 18, 2022
@techknowlogick techknowlogick merged commit 8334dcb into markbates:master Sep 19, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants