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

httpserver error, http: panic (runtime error: invalid memory address or nil pointer dereference goroutine 330 #177

Open
fa1rid opened this issue Feb 13, 2024 · 1 comment

Comments

@fa1rid
Copy link

fa1rid commented Feb 13, 2024

I enabled the httpserver, then requested connect then status:

POST http://192.168.20.16:8011/connect?uuid=123456...
POST http://192.168.20.16:8011/status?uuid=123456...

$ go-chromecast httpserver
INFO[0000] starting http server on 0.0.0.0:8011
2024/02/13 13:31:00 http: panic serving 192.168.20.38:23608: runtime error: invalid memory address or nil pointer dereference
goroutine 33 [running]:
net/http.(*conn).serve.func1()
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:1850 +0xb8
panic({0x67d2a0, 0xcd9ad0})
/opt/hostedtoolcache/go/1.19.8/x64/src/runtime/panic.go:890 +0x260
github.com/vishen/go-chromecast/http.fromApplicationStatus(_, _, _)
/home/runner/work/go-chromecast/go-chromecast/http/types.go:49 +0x58
github.com/vishen/go-chromecast/http.(*Handler).status(0x40001259e0, {0x871f20?, 0x40005260e0}, 0x0?)
/home/runner/work/go-chromecast/go-chromecast/http/handlers.go:276 +0x94
net/http.HandlerFunc.ServeHTTP(0x400015430d?, {0x871f20?, 0x40005260e0?}, 0xffffffffffffffff?)
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:2109 +0x38
net/http.(*ServeMux).ServeHTTP(0xa9020?, {0x871f20, 0x40005260e0}, 0x4000194100)
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:2487 +0x140
github.com/vishen/go-chromecast/http.(*Handler).ServeHTTP(0x400015430d?, {0x871f20?, 0x40005260e0?}, 0x2e16e8?)
/home/runner/work/go-chromecast/go-chromecast/http/handlers.go:38 +0x28
net/http.serverHandler.ServeHTTP({0x400007c630?}, {0x871f20, 0x40005260e0}, 0x4000194100)
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:2947 +0x2cc
net/http.(*conn).serve(0x40000ce140, {0x872920, 0x40003debd0})
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:1991 +0x544
created by net/http.(*Server).Serve
/opt/hostedtoolcache/go/1.19.8/x64/src/net/http/server.go:3102 +0x43c

@vishen
Copy link
Owner

vishen commented Feb 14, 2024

Looks like for some reason the application isn't being loaded correctly, and we assume that the application is always there. I think we can add a check to see if the app != nil in https://github.com/vishen/go-chromecast/blob/master/http/types.go#L49 before trying to map data from it.

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

2 participants