Skip to content

Commit

Permalink
Update pointer.go
Browse files Browse the repository at this point in the history
  • Loading branch information
aacebo committed Dec 2, 2024
1 parent e74f7c6 commit f2281cb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gq/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ func (self Pointer) Key() string {
func (self Pointer) Do(params *DoParams) Result {
value := reflect.ValueOf(params.Value)

if value.IsValid() && value.Kind() == reflect.Pointer {
if value.Kind() == reflect.Pointer {
value = value.Elem()
params.Value = value.Interface()
params.Value = nil

if value.IsValid() {
params.Value = value.Interface()
}
}

res := self.Type.Do(params)
Expand All @@ -37,9 +41,13 @@ func (self Pointer) Do(params *DoParams) Result {
func (self Pointer) Resolve(params *ResolveParams) Result {
value := reflect.ValueOf(params.Value)

if value.IsValid() && value.Kind() == reflect.Pointer {
if value.Kind() == reflect.Pointer {
value = value.Elem()
params.Value = value.Interface()
params.Value = nil

if value.IsValid() {
params.Value = value.Interface()
}
}

res := self.Type.Resolve(params)
Expand Down

0 comments on commit f2281cb

Please sign in to comment.