--- dbmail-mailbox.c.orig	Mon Apr 17 09:32:39 2006
+++ dbmail-mailbox.c	Mon Apr 17 10:13:45 2006
@@ -434,7 +434,7 @@
 	gchar *s = NULL;
 	GList *l = NULL;
 
-	if (! g_tree_nnodes(self->ids)>0)
+	if ((self->ids == NULL) || (! g_tree_nnodes(self->ids)>0))
 		return s;
 
 	t = g_string_new("");
@@ -1559,7 +1559,7 @@
 	
 	trace(TRACE_DEBUG,"%s,%s: found [%d] ids\n", 
 			__FILE__, __func__, 
-			g_tree_nnodes(self->ids));
+			(self->ids != NULL) ? g_tree_nnodes(self->ids) : 0);
 	
 	return 0;
 }
