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

panic: reflect: call of reflect.Value.Type on zero Value #25

Closed
komuw opened this issue Jul 22, 2021 · 1 comment · Fixed by #37
Closed

panic: reflect: call of reflect.Value.Type on zero Value #25

komuw opened this issue Jul 22, 2021 · 1 comment · Fixed by #37
Labels
bug Something isn't working

Comments

@komuw
Copy link
Owner

komuw commented Jul 22, 2021

package main

import (
	"github.com/komuw/kama"
	"gopkg.in/mgo.v2"
)

func main() {
	var ss *mgo.Session
	kama.Dirp(ss)
}
panic: reflect: call of reflect.Value.Type on zero Value

goroutine 1 [running]:
reflect.Value.Type(0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go-faketime/src/reflect/value.go:1908 +0x189
github.com/komuw/kama.getKind(0x7700c0, 0x0, 0xc000018650)
	/tmp/gopath982500244/pkg/mod/github.com/komuw/kama@v0.0.3/vars.go:125 +0x115
github.com/komuw/kama.newVari(0x7700c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/tmp/gopath982500244/pkg/mod/github.com/komuw/kama@v0.0.3/vars.go:37 +0x134
github.com/komuw/kama.Dir(0x7700c0, 0x0, 0xc000034748, 0x96d880)
	/tmp/gopath982500244/pkg/mod/github.com/komuw/kama@v0.0.3/kama.go:75 +0x485
github.com/komuw/kama.Dirp(0x7700c0, 0x0)
	/tmp/gopath982500244/pkg/mod/github.com/komuw/kama@v0.0.3/kama.go:35 +0x39
main.main()
	/tmp/sandbox858069193/prog.go:10 +0x36
@komuw komuw added the bug Something isn't working label Jul 22, 2021
@komuw
Copy link
Owner Author

komuw commented Jul 22, 2021

However this;

package main

import (
	"github.com/komuw/kama"
)

func main() {
	kama.Dirp(nil)
}

works out okay

[
NAME: nil
KIND: ptr
SIGNATURE: [nil]
FIELDS: []
METHODS: []
SNIPPET: nil
]

@komuw komuw closed this as completed in #37 Feb 21, 2023
komuw added a commit that referenced this issue Feb 21, 2023
What:
- Zero value pointers should not panic

Why:
- Fixes: #25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant