PaesslerAG / gval

Expression evaluation in golang
BSD 3-Clause "New" or "Revised" License
731 stars 82 forks source link

Panic when provided using struct object with null pointer field #58

Closed abdularis closed 3 years ago

abdularis commented 3 years ago

Error: panic: reflect: call of reflect.Value.Interface on zero Value [recovered] panic: reflect: call of reflect.Value.Interface on zero Value

after quick reading, I think it has something to do with the usage of reflection, it does not check whether its valid reflect Value or not

abdularis commented 3 years ago

PR https://github.com/PaesslerAG/gval/pull/59

generikvault commented 3 years ago

Hi,

thanks for the finding and solution.

the example in your pull request contains a typed nil value. This breaks the current check.

Typed nil can also occur for slices and maps.

Fixed it together with the same issue in the ? operator.

https://github.com/PaesslerAG/gval/pull/60