From 0affae2fac8bb49b23a7f9bec8d048eb5ee6c18d Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Wed, 25 Jun 2014 10:33:32 +0200 Subject: EHTMLEditorView - Process the element only if it has children --- e-util/e-html-editor-view.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'e-util') diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index 2bdd06464b..343a0d3676 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -5394,19 +5394,20 @@ convert_element_from_html_to_plain_text (EHTMLEditorView *view, first_child = webkit_dom_node_get_first_child ( WEBKIT_DOM_NODE (element)); - - if (!webkit_dom_node_has_child_nodes (first_child)) { - webkit_dom_html_element_set_inner_html ( - WEBKIT_DOM_HTML_ELEMENT (first_child), - UNICODE_ZERO_WIDTH_SPACE, + if (first_child) { + if (!webkit_dom_node_has_child_nodes (first_child)) { + webkit_dom_html_element_set_inner_html ( + WEBKIT_DOM_HTML_ELEMENT (first_child), + UNICODE_ZERO_WIDTH_SPACE, + NULL); + } + webkit_dom_node_insert_before ( + first_child, + e_html_editor_selection_get_caret_position_node ( + document), + webkit_dom_node_get_first_child (first_child), NULL); } - webkit_dom_node_insert_before ( - first_child, - e_html_editor_selection_get_caret_position_node ( - document), - webkit_dom_node_get_first_child (first_child), - NULL); *wrap = TRUE; } -- cgit v1.2.3