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
1 changed files with 2 additions and 2 deletions

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
// to actually be an empty set object...
if s.Type == TypeSet && result == nil {
result = &Set{F: s.Set}
if set, ok := result.(*Set); ok && set.F == nil {
set.F = s.Set
}
return result