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

Unified Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2707993004: Selection API: Fix a null pointer dereference in addRange(). (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/LayoutTests/editing/selection/addrange-crash.html ('k') | 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/editing/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 9d5c79129f8a36f0c44ffb284c4f318fa609f68a..1e55462980a5f9507a0a91940d4d5350cd9008d8 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -617,7 +617,8 @@ void DOMSelection::addRange(Range* newRange) {
return;
}
- Range* originalRange = selection.firstRange();
+ Range* originalRange = primaryRangeOrNull();
+ DCHECK(originalRange);
if (originalRange->startContainer()->treeScope() !=
newRange->startContainer()->treeScope()) {
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/addrange-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698