Add safety checks for file_info into emfe_attachment_format()

This could rise when printing. The attachment print can be called
multiple times, sometimes with not set `file_info` yet, which resulted
in runtime warnings.
This commit is contained in:
Milan Crha
2015-08-12 11:45:13 +02:00
parent 5a71cf5da9
commit b4ca0ea46f

View File

@ -205,7 +205,10 @@ emfe_attachment_format (EMailFormatterExtension *extension,
E_MAIL_PART_ATTACHMENT (part));
file_info = e_attachment_ref_file_info (attachment);
display_name = g_file_info_get_display_name (file_info);
if (file_info)
display_name = g_file_info_get_display_name (file_info);
else
display_name = "";
description = e_attachment_dup_description (attachment);
if (description != NULL && *description != '\0') {
@ -225,8 +228,8 @@ emfe_attachment_format (EMailFormatterExtension *extension,
g_free (description);
g_free (name);
g_object_unref (attachment);
g_object_unref (file_info);
g_clear_object (&attachment);
g_clear_object (&file_info);
}
head = g_queue_peek_head_link (extensions);