leanovate / gopter

GOlang Property TestER
MIT License
598 stars 40 forks source link

Avoid nil reference when struct has gen.PtrOf field #43

Closed rerorero closed 5 years ago

rerorero commented 5 years ago

Hi, this library looks so cool. Thanks for your efforts. I want to start using in my project but I found a bug while trial.

Panic sometimes occurs when struct generator has a field of PtrOf generator. It sometime generates nil value but struct generator tries to retrieve value via reflect.ValueOf(). When nil field is generated it should be set Zero value.

au-phiware commented 5 years ago

I have encountered this issue also and this patch works for me, thanks.

untoldwind commented 5 years ago

Ah the bane of go reflection ... ;)