Skip to content

Commit adb4ad5

Browse files
committed
Fix issue raised by the mypy hook
The `mypy` hook flagged trying to access an element of an Optional value so we must perform a None check first.
1 parent df49b3b commit adb4ad5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hash_http_content/hasher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _is_visible_element(self, element: PageElement) -> bool:
140140
if isinstance(element, Comment):
141141
logging.debug("Skipping Comment tag")
142142
return False
143-
if element.parent.name in discard_tags:
143+
if element.parent is not None and element.parent.name in discard_tags:
144144
logging.debug("Skipping element in parent tag '%s'", element.parent.name)
145145
return False
146146
return True

0 commit comments

Comments
 (0)