LibWeb: Avoid dereferencing an empty optional URL

Here, "null" means the empty optional. We don't need to also check if
the URL is valid; the url will be null if it was originally invalid.
This commit is contained in:
Timothy Flynn
2024-12-11 12:04:02 -05:00
committed by Tim Flynn
parent 0bc55424c8
commit 943ec820fc
3 changed files with 10 additions and 1 deletions

View File

@@ -427,7 +427,7 @@ String HTMLHyperlinkElementUtils::href() const
return String {};
// 4. Otherwise, if url is null, return this element's href content attribute's value.
if (!url->is_valid())
if (!url.has_value())
return href_content_attribute.release_value();
// 5. Return url, serialized.