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

Unified Diff: Source/core/editing/InputMethodController.cpp

Issue 923023002: Refactoring code so as to avoid possible crash due to null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InputMethodController.cpp
diff --git a/Source/core/editing/InputMethodController.cpp b/Source/core/editing/InputMethodController.cpp
index 887653a3df8360e0c2105c390761ea6010fe9020..0cb0cf325106f29e2d1e3aa1f31aaefde78e36f4 100644
--- a/Source/core/editing/InputMethodController.cpp
+++ b/Source/core/editing/InputMethodController.cpp
@@ -318,13 +318,13 @@ void InputMethodController::setCompositionFromExistingText(const Vector<Composit
Element* editable = frame().selection().rootEditableElement();
Position base = frame().selection().base().downstream();
Node* baseNode = base.anchorNode();
- if (editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) {
+ if (baseNode && editable->firstChild() == baseNode && editable->lastChild() == baseNode && baseNode->isTextNode()) {
m_compositionNode = nullptr;
m_customCompositionUnderlines.clear();
if (base.anchorType() != Position::PositionIsOffsetInAnchor)
return;
- if (!baseNode || baseNode != frame().selection().extent().anchorNode())
+ if (baseNode != frame().selection().extent().anchorNode())
return;
m_compositionNode = toText(baseNode);
« 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