Commit a2dfd08b authored by Milan Crha's avatar Milan Crha
Browse files

Bug 773420 - Prevent crash when e_content_editor_get_content() returns NULL

parent 8117e073
......@@ -1249,6 +1249,11 @@ composer_build_message (EMsgComposer *composer,
E_CONTENT_EDITOR_GET_PROCESSED,
NULL, NULL);
if (!text) {
g_warning ("%s: Failed to retrieve text/plain processed content", G_STRFUNC);
text = g_strdup ("");
}
g_byte_array_append (data, (guint8 *) text, strlen (text));
g_free (text);
......@@ -1335,6 +1340,11 @@ composer_build_message (EMsgComposer *composer,
E_CONTENT_EDITOR_GET_TEXT_HTML |
E_CONTENT_EDITOR_GET_INLINE_IMAGES,
from_domain, &inline_images_parts);
if (!text) {
g_warning ("%s: Failed to retrieve draft content", G_STRFUNC);
text = g_strdup ("");
}
} else {
text = e_content_editor_get_content (
cnt_editor,
......@@ -1342,6 +1352,11 @@ composer_build_message (EMsgComposer *composer,
E_CONTENT_EDITOR_GET_PROCESSED |
E_CONTENT_EDITOR_GET_INLINE_IMAGES,
from_domain, &inline_images_parts);
if (!text) {
g_warning ("%s: Failed to retrieve HTML processed content", G_STRFUNC);
text = g_strdup ("");
}
}
length = strlen (text);
......@@ -5176,6 +5191,11 @@ e_msg_composer_get_raw_message_text_without_signature (EMsgComposer *composer)
E_CONTENT_EDITOR_GET_EXCLUDE_SIGNATURE,
NULL, NULL);
if (!content) {
g_warning ("%s: Failed to retrieve content", G_STRFUNC);
content = g_strdup ("");
}
return g_byte_array_new_take ((guint8 *) content, strlen (content));
}
......@@ -5202,6 +5222,11 @@ e_msg_composer_get_raw_message_text (EMsgComposer *composer)
E_CONTENT_EDITOR_GET_TEXT_PLAIN,
NULL, NULL);
if (!content) {
g_warning ("%s: Failed to retrieve content", G_STRFUNC);
content = g_strdup ("");
}
return g_byte_array_new_take ((guint8 *) content, strlen (content));
}
......
......@@ -1325,6 +1325,7 @@ e_html_editor_save (EHTMLEditor *editor,
NULL, NULL);
if (!content || !*content) {
g_free (content);
g_set_error (
error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to obtain content of editor");
......
......@@ -949,6 +949,11 @@ e_mail_signature_editor_commit (EMailSignatureEditor *window,
E_CONTENT_EDITOR_GET_BODY,
NULL, NULL);
if (!contents) {
g_warning ("%s: Failed to retrieve content", G_STRFUNC);
contents = g_strdup ("");
}
extension_name = E_SOURCE_EXTENSION_MAIL_SIGNATURE;
extension = e_source_get_extension (source, extension_name);
e_source_mail_signature_set_mime_type (extension, mime_type);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment