Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: third_party/WebKit/Source/core/dom/VisitedLinkState.cpp

Issue 1908893002: Check document.firstChild() exists to avoid nullptr deref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/VisitedLinkState.cpp
diff --git a/third_party/WebKit/Source/core/dom/VisitedLinkState.cpp b/third_party/WebKit/Source/core/dom/VisitedLinkState.cpp
index da0c1a85c977e5dd04ee564cfe4b522c02c8fb2f..193fb2c119417cbbb114d904a13ad04af28a1d5d 100644
--- a/third_party/WebKit/Source/core/dom/VisitedLinkState.cpp
+++ b/third_party/WebKit/Source/core/dom/VisitedLinkState.cpp
@@ -79,7 +79,7 @@ static void invalidateStyleForAllLinksRecursively(Node& rootNode, bool invalidat
void VisitedLinkState::invalidateStyleForAllLinks(bool invalidateVisitedLinkHashes)
{
- if (!m_linksCheckedForVisitedState.isEmpty())
+ if (!m_linksCheckedForVisitedState.isEmpty() && document().firstChild())
invalidateStyleForAllLinksRecursively(*document().firstChild(), invalidateVisitedLinkHashes);
}
@@ -99,7 +99,7 @@ static void invalidateStyleForLinkRecursively(Node& rootNode, LinkHash linkHash)
void VisitedLinkState::invalidateStyleForLink(LinkHash linkHash)
{
- if (m_linksCheckedForVisitedState.contains(linkHash))
+ if (m_linksCheckedForVisitedState.contains(linkHash) && document().firstChild())
invalidateStyleForLinkRecursively(*document().firstChild(), linkHash);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698