diff --git a/j2cfg/j2cfg/functions.py b/j2cfg/j2cfg/functions.py index 480d791..6ba995d 100644 --- a/j2cfg/j2cfg/functions.py +++ b/j2cfg/j2cfg/functions.py @@ -278,11 +278,19 @@ def merge_dict_recurse(d1, d2: dict) -> dict: map_common = {k for k in map1 if is_mapping(d2.get(k))} for k in map_common: - x[k] = merge_dict_recurse(x.get(k), d2.get(k)) + y = d2.get(k) + if not y: + x[k] = {} + continue + x[k] = merge_dict_recurse(x.get(k), y) seq_common = {k for k in seq1 if is_sequence(d2.get(k))} for k in seq_common: - x[k] = uniq(list(x.get(k)) + list(d2.get(k))) + y = d2.get(k) + if not y: + x[k] = [] + continue + x[k] = uniq(list(x.get(k)) + list(y)) unmerged = (map1 - map_common) | (seq1 - seq_common) for k in unmerged: