Skip to content

fix the bug reflect on zero Value#69

Merged
thoas merged 1 commit into
thoas:masterfrom
ninghejun:patch-1
Nov 24, 2019
Merged

fix the bug reflect on zero Value#69
thoas merged 1 commit into
thoas:masterfrom
ninghejun:patch-1

Conversation

@ninghejun

@ninghejun ninghejun commented Nov 21, 2019

Copy link
Copy Markdown
Contributor

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

thoas commented Nov 24, 2019

Copy link
Copy Markdown
Owner

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.

2 participants