Fix deserialization for default values
This commit is contained in:
parent
1e7900d730
commit
1c6b3aceee
1 changed files with 7 additions and 3 deletions
|
@ -349,10 +349,14 @@ pub fn DeserializerContext(comptime Result: type, comptime From: type, comptime
|
|||
any_missing = true;
|
||||
}
|
||||
}
|
||||
if (any_missing) {
|
||||
return if (any_explicit) error.MissingField else null;
|
||||
}
|
||||
if (any_missing and any_explicit) return error.MissingField;
|
||||
|
||||
if (!any_explicit) {
|
||||
inline for (info.fields) |field, i| {
|
||||
if (fields_alloced[i]) self.deserializeFree(allocator, @field(result, field.name));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue