diff options
author | George Mount <mount@google.com> | 2012-03-02 14:29:54 -0800 |
---|---|---|
committer | George Mount <mount@google.com> | 2012-03-02 14:48:46 -0800 |
commit | 1045cce1e3570e0eba94274e8960e1ed7a2335d0 (patch) | |
tree | 1c93bd531b7f1d49a7e4c7cc6563d88da738ece2 /Source/WebKit | |
parent | 57ae1393d3097edada2640b40c895396b69cc919 (diff) | |
download | external_webkit-1045cce1e3570e0eba94274e8960e1ed7a2335d0.zip external_webkit-1045cce1e3570e0eba94274e8960e1ed7a2335d0.tar.gz external_webkit-1045cce1e3570e0eba94274e8960e1ed7a2335d0.tar.bz2 |
Fix crash when getting input text on an empty node.
Bug 6109122
Change-Id: I1ecc5a599256dfb4701eb1f57f950b8950acf006
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index c3937bc..4c65fe6 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -3655,11 +3655,11 @@ String WebViewCore::getInputText(Node* node) text = renderText->text(); else { // It must be content editable field. - Position inNode(node, 0); Position start = firstPositionInNode(node); Position end = lastPositionInNode(node); VisibleSelection allEditableText(start, end); - text = allEditableText.firstRange()->text(); + if (allEditableText.isRange()) + text = allEditableText.firstRange()->text(); } return text; } @@ -4198,12 +4198,14 @@ String WebViewCore::getText(int startX, int startY, int endX, int endY) for (size_t i = 0; i < ranges.size(); i++) { const VisibleSelection& selection = ranges[i]; - PassRefPtr<Range> range = selection.firstRange(); - String textInRange = range->text(); - if (textInRange.length() > 0) { - if (text.length() > 0) - text.append('\n'); - text.append(textInRange); + if (selection.isRange()) { + PassRefPtr<Range> range = selection.firstRange(); + String textInRange = range->text(); + if (textInRange.length() > 0) { + if (text.length() > 0) + text.append('\n'); + text.append(textInRange); + } } } |