@@ -1707,8 +1707,11 @@ def write_detailed_html(html_file_detailed: str, diffStix: DiffStix):
17071707 if detailed_change_type == "values_changed" :
17081708 for detailed_change , values in detailed_changes .items ():
17091709 matches = re .search (regex , detailed_change )
1710- top_stix_key = matches .group ("top_stix_key" )
1711- the_rest = matches .group ("the_rest" )
1710+ if matches :
1711+ top_stix_key = matches .group ("top_stix_key" )
1712+ the_rest = matches .group ("the_rest" )
1713+ else :
1714+ continue
17121715 stix_field = f"{ top_stix_key } { the_rest } "
17131716
17141717 old_value = values ["old_value" ]
@@ -1721,7 +1724,10 @@ def write_detailed_html(html_file_detailed: str, diffStix: DiffStix):
17211724
17221725 elif detailed_change_type == "iterable_item_added" :
17231726 for detailed_change , new_value in detailed_changes .items ():
1724- stix_field = re .search (regex , detailed_change ).group ("top_stix_key" )
1727+ match = re .search (regex , detailed_change )
1728+ if not match :
1729+ continue
1730+ stix_field = match .group ("top_stix_key" )
17251731 lines .append ("<tr>" )
17261732 lines .append (f"<td { table_inline_css } >{ stix_field } </td>" )
17271733 lines .append (f"<td { table_inline_css } ></td>" )
@@ -1730,7 +1736,10 @@ def write_detailed_html(html_file_detailed: str, diffStix: DiffStix):
17301736
17311737 elif detailed_change_type == "iterable_item_removed" :
17321738 for detailed_change , old_value in detailed_changes .items ():
1733- stix_field = re .search (regex , detailed_change ).group ("top_stix_key" )
1739+ match = re .search (regex , detailed_change )
1740+ if not match :
1741+ continue
1742+ stix_field = match .group ("top_stix_key" )
17341743 lines .append ("<tr>" )
17351744 lines .append (f"<td { table_inline_css } >{ stix_field } </td>" )
17361745 lines .append (f"<td { table_inline_css } >{ old_value } </td>" )
@@ -1739,7 +1748,10 @@ def write_detailed_html(html_file_detailed: str, diffStix: DiffStix):
17391748
17401749 elif detailed_change_type == "dictionary_item_added" :
17411750 for detailed_change , new_value in detailed_changes .items ():
1742- stix_field = re .search (regex , detailed_change ).group ("top_stix_key" )
1751+ match = re .search (regex , detailed_change )
1752+ if not match :
1753+ continue
1754+ stix_field = match .group ("top_stix_key" )
17431755 lines .append ("<tr>" )
17441756 lines .append (f"<td { table_inline_css } >{ stix_field } </td>" )
17451757 lines .append (f"<td { table_inline_css } ></td>" )
@@ -1748,7 +1760,10 @@ def write_detailed_html(html_file_detailed: str, diffStix: DiffStix):
17481760
17491761 elif detailed_change_type == "dictionary_item_removed" :
17501762 for detailed_change , old_value in detailed_changes .items ():
1751- stix_field = re .search (regex , detailed_change ).group ("top_stix_key" )
1763+ match = re .search (regex , detailed_change )
1764+ if not match :
1765+ continue
1766+ stix_field = match .group ("top_stix_key" )
17521767 lines .append ("<tr>" )
17531768 lines .append (f"<td { table_inline_css } >{ stix_field } </td>" )
17541769 lines .append (f"<td { table_inline_css } >{ old_value } </td>" )
0 commit comments