diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 53d10e8..c77cb29 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1944,6 +1944,12 @@ emfh_multipart_related_check(struct _EMFormatHTMLJob *job, gint cancelled)
 
 	link = g_queue_peek_head_link (job->puri_level->data);
 
+	if (!link) {
+		g_string_printf (format->part_id, "%s", oldpartid);
+		g_free (oldpartid);
+		return;
+	}
+
 	while (link->next != NULL) {
 		EMFormatPURI *puri = link->data;
 
