summaryrefslogtreecommitdiffstats
path: root/editor/libeditor
diff options
context:
space:
mode:
Diffstat (limited to 'editor/libeditor')
-rw-r--r--editor/libeditor/HTMLEditor.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp
index 368f7a3e9..532da7a15 100644
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -3344,12 +3344,18 @@ HTMLEditor::GetIsSelectionEditable(bool* aIsSelectionEditable)
RefPtr<Selection> selection = GetSelection();
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
+ nsINode* anchorNode = selection->GetAnchorNode();
+ nsINode* focusNode = selection->GetFocusNode();
+ if (!anchorNode || !focusNode) {
+ return NS_ERROR_FAILURE;
+ }
+
// Per the editing spec as of June 2012: we have to have a selection whose
// start and end nodes are editable, and which share an ancestor editing
// host. (Bug 766387.)
*aIsSelectionEditable = selection->RangeCount() &&
- selection->GetAnchorNode()->IsEditable() &&
- selection->GetFocusNode()->IsEditable();
+ anchorNode->IsEditable() &&
+ focusNode->IsEditable();
if (*aIsSelectionEditable) {
nsINode* commonAncestor =