mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 21:02:27 +08:00
fix: fix issue #162
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
// Package pointer contains some util functions to operate go pointer.
|
||||
package pointer
|
||||
|
||||
import "reflect"
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// Of returns a pointer to the value `v`.
|
||||
// Play: https://go.dev/play/p/HFd70x4DrMj
|
||||
@@ -47,5 +49,10 @@ func ExtractPointer(value any) any {
|
||||
if t.Kind() != reflect.Pointer {
|
||||
return value
|
||||
}
|
||||
return ExtractPointer(v.Elem().Interface())
|
||||
|
||||
if v.Elem().IsValid() {
|
||||
return ExtractPointer(v.Elem().Interface())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user