1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-17 15:49:53 +00:00

fix nil pointer exceptions

This commit is contained in:
Daishan Peng
2018-01-22 15:44:51 -07:00
committed by Darren Shepherd
parent da40fa7b06
commit 1e15dbfbdc

View File

@@ -216,6 +216,9 @@ func findCond(val reflect.Value, name string) *reflect.Value {
} }
func getValue(obj interface{}, name ...string) reflect.Value { func getValue(obj interface{}, name ...string) reflect.Value {
if obj == nil {
return reflect.Value{}
}
v := reflect.ValueOf(obj) v := reflect.ValueOf(obj)
t := v.Type() t := v.Type()
if t.Kind() == reflect.Ptr { if t.Kind() == reflect.Ptr {