Skip to content

Commit

Permalink
Catch StopIteration exception in json plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
simisimon committed Dec 12, 2024
1 parent efb412a commit 596d9ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cfgnet/plugins/file_type/json_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def _parse_json_object(
if not isinstance(parent, ArtifactNode):
name = json_object
value = ValueNode(name=name)

parent.add_child(value)

@staticmethod
Expand All @@ -139,5 +138,8 @@ def _get_line_number(lines_dict: Dict, name: str) -> str:
:param: name: name of option
:return: line number of option
"""
line = next(filter(lambda x: f'"{name}"' in x, lines_dict.keys()))
return lines_dict[line]
try:
line = next(filter(lambda x: f'"{name}"' in x, lines_dict.keys()))
return lines_dict[line]
except StopIteration:
return "None"

0 comments on commit 596d9ad

Please sign in to comment.