diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-07-10 16:09:48 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-07-10 16:14:02 +0800 |
commit | bcd0f3b0d90dae28135b9a82ff42f8843485fd35 (patch) | |
tree | 230a681f201e70647938367b45b85bf275b225a6 | |
parent | c082d6b81b7a32ad5a299331572690439d440691 (diff) | |
download | gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar.gz gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar.bz2 gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar.lz gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar.xz gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.tar.zst gsoc2013-evolution-bcd0f3b0d90dae28135b9a82ff42f8843485fd35.zip |
Bug 732891 - Crash under process_elements() at e-html-editor-view.c:5004
Check if the buffer already contains some data before doing some work
on it.
-rw-r--r-- | e-util/e-html-editor-view.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index 5262dec41c..03d9cb7a32 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -4871,11 +4871,14 @@ process_elements (EHTMLEditorView *view, /* Replace tabs with 8 whitespaces, otherwise they got * replaced by single whitespace */ if (strstr (content, "\x9")) { - gchar *start_of_line = g_strrstr_len ( - buffer->str, -1, "\n") + 1; + if (buffer->str && *buffer->str) { + gchar *start_of_line = g_strrstr_len ( + buffer->str, -1, "\n") + 1; - if (start_of_line && *start_of_line) - char_count = strlen (start_of_line); + if (start_of_line && *start_of_line) + char_count = strlen (start_of_line); + } else + char_count = 0; regex = g_regex_new ("\x9", 0, 0, NULL); tmp = g_regex_replace_eval ( @@ -4998,11 +5001,14 @@ process_elements (EHTMLEditorView *view, /* Replace tabs with 8 whitespaces, otherwise they got * replaced by single whitespace */ if (strstr (content, "\x9")) { - gchar *start_of_line = g_strrstr_len ( - buffer->str, -1, "\n") + 1; - - if (start_of_line && *start_of_line) - char_count = strlen (start_of_line); + if (buffer->str && *buffer->str) { + gchar *start_of_line = g_strrstr_len ( + buffer->str, -1, "\n") + 1; + + if (start_of_line && *start_of_line) + char_count = strlen (start_of_line); + } else + char_count = 0; regex = g_regex_new ("\x9", 0, 0, NULL); tmp = g_regex_replace_eval ( |