Skip to content

Commit

Permalink
cmu: Don't crash if the fieldgetter has no data
Browse files Browse the repository at this point in the history
In some cases the fieldgetter won't return any data.
If so, just skip to the next element.

Signed-off-by: David Weinehall <[email protected]>
  • Loading branch information
taotriad committed Apr 16, 2024
1 parent fe714a0 commit ff4cec8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmu
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,8 @@ def get_obj(obj: Dict, field_dict: Dict, field_names: List[str],
_values.append((tuple(__values), "raw"))
elif ptype == "fieldgetter":
fieldgetter_data = deep_get_with_fallback(obj, path, {})
if not fieldgetter_data:
continue
fieldgetter_tmp = deep_get(fieldgetter_data, DictPath("fieldgetter"))
fieldgetter = deep_get(fieldgetter_allowlist, DictPath(fieldgetter_tmp))
if fieldgetter is None:
Expand Down

0 comments on commit ff4cec8

Please sign in to comment.