Skip to content

Commit

Permalink
moving jsonValue nil check after extension processing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ythadhani committed May 3, 2022
1 parent ba4a7b5 commit eb6a865
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ytypes/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ func unmarshalStruct(schema *yang.Entry, parent interface{}, jsonTree map[string
return err
}

if jsonValue == nil {
util.DbgPrint("field %s paths %v not present in tree", ft.Name, sp)
continue
}

if extensions, hasExtensions := ft.Tag.Lookup("extensions"); hasExtensions {
if unmarshalConf.extHandler != nil {
jsonValue, err = yext.ProcessExtensions(jsonValue, extensions, unmarshalConf.extHandler)
Expand All @@ -224,6 +219,11 @@ func unmarshalStruct(schema *yang.Entry, parent interface{}, jsonTree map[string
}
}

if jsonValue == nil {
util.DbgPrint("field %s paths %v not present in tree", ft.Name, sp)
continue
}

util.DbgPrint("populating field %s type %s with paths %v.", ft.Name, ft.Type, sp)
// Only create a new field if it is nil, otherwise update just the
// fields that are in the data tree being passed to unmarshal, and
Expand Down

0 comments on commit eb6a865

Please sign in to comment.