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

fix the bug reflect on zero Value #69

Merged
merged 1 commit into from
Nov 24, 2019
Merged

fix the bug reflect on zero Value #69

merged 1 commit into from
Nov 24, 2019

Conversation

ninghejun
Copy link
Contributor

@ninghejun ninghejun commented Nov 21, 2019

fix the bug :reflect: call of reflect.Value.Type on zero Value

if the slice is nil, or len==0, will be panic.
the case:

type Foo struct{
	Bar[]int
}

func TestGoFunk(t *testing.T) {
	foo := []Foo{}
	bars := funk.Get(foo, "Bar") //panic !!
	fmt.Print(bars)
}

fix the bug :reflect: call of reflect.Value.Type on zero Value

if the slice is nil, or len==0, will be panic.
the case:

type Foo struct{
	Bar[]int
}

func TestGoFunk(t *testing.T) {
	Log.InitLog()
	foo := []Foo{}
	bars := funk.Get(foo, "Bar") //panic !!
	fmt.Print(bars)
}
@thoas thoas merged commit 3108806 into thoas:master Nov 24, 2019
@thoas
Copy link
Owner

thoas commented Nov 24, 2019

Thank you!

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