helper/schema: zero value set should set function [GH-1009]

This commit is contained in:
Mitchell Hashimoto 2015-02-19 11:26:02 -08:00
parent f4408f2e63
commit 0bc0c03fec

View File

@ -42,8 +42,8 @@ func (r *FieldReadResult) ValueOrZero(s *Schema) interface{} {
// The zero value of a set is nil, but we want it // The zero value of a set is nil, but we want it
// to actually be an empty set object... // to actually be an empty set object...
if s.Type == TypeSet && result == nil { if set, ok := result.(*Set); ok && set.F == nil {
result = &Set{F: s.Set} set.F = s.Set
} }
return result return result