openconfig / ygot

A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
Apache License 2.0
284 stars 106 forks source link

Avoid panic when calling Elem on a nil map member. #941

Closed robshakir closed 9 months ago

robshakir commented 9 months ago
 * (M) ygot/struct_validation_map(_test)?.go
   - if a map was received that had a nil value in it, this caused
     a panic to occur since `(reflect.Value).Elem()` does not handle
     these cases cleanly. Add a check whether the value is nil before
     calling Elem.
coveralls commented 9 months ago

Coverage Status

coverage: 89.612% (+0.002%) from 89.61% when pulling b7a874c41b4a518ddfb10db483148e5b6231a0b6 on copy-reflect-panic into 4dcc65ef1230778675d989ce9a4d194512974f17 on master.