Index: camel/camel-db.c
===================================================================
--- camel/camel-db.c	(revision 10100)
+++ camel/camel-db.c	(working copy)
@@ -951,6 +951,9 @@ read_uids_flags_callback (void *ref, int
 	 
 	int i;
 	for (i = 0; i < ncol; ++i) {
+		if (!cols [i] && (g_str_equal (name [i], "uid") || g_str_equal (name [i], "flags")))
+			break;
+
 		if (!strcmp (name [i], "uid"))
 			g_ptr_array_add (data->uids, (char *) (camel_pstring_strdup(cols [i])));
 		else if (!strcmp (name [i], "flags"))
@@ -995,10 +998,11 @@ read_uids_callback (void *ref, int ncol,
 	#if 0
 	int i;
 	for (i = 0; i < ncol; ++i) {
-		if (!strcmp (name [i], "uid"))
+		if (cols [i] && !strcmp (name [i], "uid"))
 			g_ptr_array_add (array, (char *) (camel_pstring_strdup(cols [i])));
 	}
 	#else
+		if (cols [0])
 			g_ptr_array_add (array, (char *) (camel_pstring_strdup(cols [0])));
 	#endif
 	 
Index: camel/ChangeLog
===================================================================
--- camel/ChangeLog	(revision 10100)
+++ camel/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2009-02-26  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #573125
+
+	* camel-db.c: (read_uids_flags_callback), (read_uids_callback):
+	* camel-folder-summary.c: (camel_read_mir_callback):
+	Skip incomplete rows.
+
 2009-02-25  Milan Crha  <mcrha@redhat.com>
 
 	* camel-smime-context.c: (nss_error_to_string):
Index: camel/camel-folder-summary.c
===================================================================
--- camel/camel-folder-summary.c	(revision 10100)
+++ camel/camel-folder-summary.c	(working copy)
@@ -1046,7 +1046,12 @@ camel_read_mir_callback (void * ref, int
 
 	mir = g_new0 (CamelMIRecord , 1);
 	mir_from_cols (mir, s, ncol, cols, name);
-	
+
+	if (!mir->uid) {
+		camel_db_camel_mir_free (mir);
+		return ret;
+	}
+
 	CAMEL_SUMMARY_LOCK (s, summary_lock);
 	if (g_hash_table_lookup (s->loaded_infos, mir->uid)) {
 		/* Unlock and better return*/
