Skip to content

Commit

Permalink
Merge pull request #10 from mazmrini/fix/decode-dataclass-with-None-a…
Browse files Browse the repository at this point in the history
…s-field-value

added field value None check in decode dataclass
  • Loading branch information
lidatong authored Aug 31, 2018
2 parents a0de8a8 + f3173c6 commit 3120cfe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dataclasses_json/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def _decode_dataclass(cls, kvs, infer_missing):
init_kwargs = {}
for field in fields(cls):
field_value = kvs[field.name]
if is_dataclass(field.type):
if field_value is None:
init_kwargs[field.name] = field_value
elif is_dataclass(field.type):
init_kwargs[field.name] = _decode_dataclass(field.type,
field_value,
infer_missing)
Expand Down

0 comments on commit 3120cfe

Please sign in to comment.