diff --git a/linkcheck/htmlutil/linkparse.py b/linkcheck/htmlutil/linkparse.py
index d8b586aa..94acdfcf 100644
--- a/linkcheck/htmlutil/linkparse.py
+++ b/linkcheck/htmlutil/linkparse.py
@@ -159,8 +159,8 @@ class LinkFinder:
base = self.base_ref
# note: value can be None
value = attrs.get(attr)
- rel = attrs.get('rel', '').lower()
- if tag == 'link' and ('dns-prefetch' in rel or 'preconnect' in rel):
+ if tag == 'link' and (rel := attrs.get('rel', '').lower()) \
+ and ('dns-prefetch' in rel or 'preconnect' in rel):
if ':' in value:
value = value.split(':', 1)[1]
value = 'dns:' + value.rstrip('/')