[evolution/wip/tpopela/composer-dnd: 1/5] Possible crash while refreshing spellcheck



commit 15efa578b3fd93b36e5c789ad196e4a40892b2fc
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 9 11:06:58 2017 +0100

    Possible crash while refreshing spellcheck
    
    Avoid possible crash if the BODY contains only text nodes and not any elements.
    Normally this can't happen unless the user drag and drops (or inserts) some HTML
    content that was not written in the composer and the composer mode is set to
    HTML.

 .../web-extension/e-editor-dom-functions.c         |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 942770d..ea34ec5 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -695,6 +695,8 @@ e_editor_dom_force_spell_check_for_current_paragraph (EEditorPage *editor_page)
        e_editor_page_block_selection_changed (editor_page);
 
        parent = get_parent_block_element (WEBKIT_DOM_NODE (selection_end_marker));
+       if (!parent)
+               parent = WEBKIT_DOM_ELEMENT (body);
 
        /* Append some text on the end of the element */
        text = webkit_dom_document_create_text_node (document, "-x-evo-end");
@@ -704,6 +706,8 @@ e_editor_dom_force_spell_check_for_current_paragraph (EEditorPage *editor_page)
                NULL);
 
        parent = get_parent_block_element (WEBKIT_DOM_NODE (selection_start_marker));
+       if (!parent)
+               parent = WEBKIT_DOM_ELEMENT (body);
 
        /* Create range that's pointing on the end of this text */
        end_range = webkit_dom_document_create_range (document);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]