Index: camel/providers/imap/camel-imap-store.c
===================================================================
--- camel/providers/imap/camel-imap-store.c	(revision 10198)
+++ camel/providers/imap/camel-imap-store.c	(working copy)
@@ -2504,7 +2504,7 @@ get_folders_sync(CamelImapStore *imap_st
 		for (i = 0; i < response->untagged->len; i++) {
 			list = response->untagged->pdata[i];
 			fi = parse_list_response_as_folder_info (imap_store, list);
-			if (fi) {
+			if (fi && *fi->full_name) {
 				hfi = g_hash_table_lookup(present, fi->full_name);
 				if (hfi == NULL) {
 					if (j == 1) {
@@ -2518,6 +2518,8 @@ get_folders_sync(CamelImapStore *imap_st
 						hfi->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
 					camel_folder_info_free(fi);
 				}
+			} else if (fi) {
+				camel_folder_info_free (fi);
 			}
 		}
 		camel_imap_response_free (imap_store, response);
@@ -2529,11 +2531,19 @@ get_folders_sync(CamelImapStore *imap_st
 	count = camel_store_summary_count((CamelStoreSummary *)imap_store->summary);
 
 	for (i=0;i<count;i++) {
+		const char *full_name;
+
 		si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
 		if (si == NULL)
 			continue;
 
-		if (imap_match_pattern(imap_store->dir_sep, pattern, camel_imap_store_info_full_name(imap_store->summary, si))) {
+		full_name = camel_imap_store_info_full_name (imap_store->summary, si);
+		if (!full_name || !*full_name) {
+			camel_store_summary_info_free ((CamelStoreSummary *)imap_store->summary, si);
+			continue;
+		}
+		
+		if (imap_match_pattern (imap_store->dir_sep, pattern, full_name)) {
 			if ((fi = g_hash_table_lookup(present, camel_store_info_path(imap_store->summary, si))) != NULL) {
 				if (((fi->flags ^ si->flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)) {
 					si->flags = (si->flags & ~CAMEL_FOLDER_SUBSCRIBED) | (fi->flags & CAMEL_FOLDER_SUBSCRIBED);
@@ -2818,13 +2828,20 @@ get_folder_info_offline (CamelStore *sto
 
 	for (i=0;i<camel_store_summary_count((CamelStoreSummary *)imap_store->summary);i++) {
 		CamelStoreInfo *si = camel_store_summary_index((CamelStoreSummary *)imap_store->summary, i);
+		const char *full_name;
 
 		if (si == NULL)
 			continue;
-		
-		if ((!strcmp(name, camel_imap_store_info_full_name(imap_store->summary, si))
-		     || imap_match_pattern(imap_store->dir_sep, pattern, camel_imap_store_info_full_name(imap_store->summary, si))
-		     || (include_inbox && !g_ascii_strcasecmp (camel_imap_store_info_full_name(imap_store->summary, si), "INBOX")))
+
+		full_name = camel_imap_store_info_full_name (imap_store->summary, si);
+		if (!full_name || !*full_name) {
+			camel_store_summary_info_free ((CamelStoreSummary *)imap_store->summary, si);
+			continue;
+		}
+
+		if ((!strcmp (name, full_name)
+		     || imap_match_pattern (imap_store->dir_sep, pattern, full_name)
+		     || (include_inbox && !g_ascii_strcasecmp (full_name, "INBOX")))
 		    && ((imap_store->parameters & IMAP_PARAM_SUBSCRIPTIONS) == 0
 			|| (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) == 0
 			|| (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED))) {
Index: camel/providers/imap/ChangeLog
===================================================================
--- camel/providers/imap/ChangeLog	(revision 10198)
+++ camel/providers/imap/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2009-04-06  Milan Crha  <mcrha@redhat.com>
+
+	** Part of fix for bug #337082
+
+	* camel-imap-store.c: (get_folders_sync), (get_folder_info_offline):
+	Never include folders with empty full_name.
+
 2009-03-09  Matthew Barnes  <mbarnes@redhat.com>
 
 	* camel-imap-summary.c (camel_imap_summary_new):
