[evolution] EHTMLEditorView - Process the element only if it has children



commit 0affae2fac8bb49b23a7f9bec8d048eb5ee6c18d
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Jun 25 10:33:32 2014 +0200

    EHTMLEditorView - Process the element only if it has children

 e-util/e-html-editor-view.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2bdd064..343a0d3 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;
        }


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