[evolution] EHTMLEditorView - Avoid critical warnings when pressing backspace on the beginning of the quoted con



commit e3849d0f090cc292b5ff4282d694854f20369906
Author: Tomas Popela <tpopela redhat com>
Date:   Sun Aug 17 09:02:11 2014 +0200

    EHTMLEditorView - Avoid critical warnings when pressing backspace on the beginning of the quoted content

 e-util/e-html-editor-view.c |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index be378b4..d5fcdc9 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -2342,24 +2342,26 @@ change_quoted_block_to_normal (EHTMLEditorView *view)
                paragraph = insert_new_line_into_citation (view, inner_html);
                g_free (inner_html);
 
-               if (view->priv->html_mode) {
-                       webkit_dom_node_insert_before (
-                               WEBKIT_DOM_NODE (paragraph),
-                               WEBKIT_DOM_NODE (selection_start_marker),
-                               webkit_dom_node_get_first_child (
-                                       WEBKIT_DOM_NODE (paragraph)),
-                               NULL);
-                       webkit_dom_node_insert_before (
-                               WEBKIT_DOM_NODE (paragraph),
-                               WEBKIT_DOM_NODE (selection_end_marker),
-                               webkit_dom_node_get_first_child (
-                                       WEBKIT_DOM_NODE (paragraph)),
-                               NULL);
+               if (paragraph) {
+                       if (view->priv->html_mode) {
+                               webkit_dom_node_insert_before (
+                                       WEBKIT_DOM_NODE (paragraph),
+                                       WEBKIT_DOM_NODE (selection_start_marker),
+                                       webkit_dom_node_get_first_child (
+                                               WEBKIT_DOM_NODE (paragraph)),
+                                       NULL);
+                               webkit_dom_node_insert_before (
+                                       WEBKIT_DOM_NODE (paragraph),
+                                       WEBKIT_DOM_NODE (selection_end_marker),
+                                       webkit_dom_node_get_first_child (
+                                               WEBKIT_DOM_NODE (paragraph)),
+                                       NULL);
 
-               }
+                       }
 
-               remove_quoting_from_element (paragraph);
-               remove_wrapping_from_element (paragraph);
+                       remove_quoting_from_element (paragraph);
+                       remove_wrapping_from_element (paragraph);
+               }
 
                if (block)
                        remove_node (WEBKIT_DOM_NODE (block));
@@ -2367,9 +2369,11 @@ change_quoted_block_to_normal (EHTMLEditorView *view)
                        document, "-x-evo-to-remove");
                if (block)
                        remove_node (WEBKIT_DOM_NODE (block));
-               remove_node_if_empty (
-                       webkit_dom_node_get_next_sibling (
-                               WEBKIT_DOM_NODE (paragraph)));
+
+               if (paragraph)
+                       remove_node_if_empty (
+                               webkit_dom_node_get_next_sibling (
+                                       WEBKIT_DOM_NODE (paragraph)));
        }
 
        if (success && citation_level > 1) {


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