diff --git a/mail/em-utils.c b/mail/em-utils.c
index 0b65b63..749d3d1 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -952,6 +952,12 @@ em_utils_selection_set_urilist (GtkSelectionData *data,
 	gchar *save_file_format;
 	gboolean save_as_mbox;
 
+	g_return_if_fail (uids != NULL);
+
+	/* can be 0 with empty folders */
+	if (!uids->len)
+		return;
+
 	tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX");
 	if (tmpdir == NULL)
 		return;
