Skip to content

Commit

Permalink
Remove KeyError bug
Browse files Browse the repository at this point in the history
  • Loading branch information
castaples committed Aug 29, 2024
1 parent 687e10a commit b848606
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions misp_stix_converter/stix2misp/external_stix2_to_misp.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ def _handle_unparsed_content(self):
return super()._handle_unparsed_content()
unparsed_content = defaultdict(list)
for object_id, content in self._observable.items():
if content['used'][self.misp_event.uuid]:
continue
if self.misp_event.uuid in content['used']:
if content['used'][self.misp_event.uuid]:
continue
unparsed_content[content['observable'].type].append(object_id)
for observable_type in self._mapping.observable_object_types():
if observable_type not in unparsed_content:
Expand All @@ -180,8 +181,9 @@ def _handle_unparsed_content(self):
continue
to_call = f'_parse_{feature}_observable_object'
for object_id in unparsed_content[observable_type]:
if self._observable[object_id]['used'][self.misp_event.uuid]:
continue
if self.misp_event.uuid in self._observable[object_id]['used']:
if self._observable[object_id]['used'][self.misp_event.uuid]:
continue
try:
getattr(self.observable_object_parser, to_call)(object_id)
except Exception as exception:
Expand Down

0 comments on commit b848606

Please sign in to comment.