changeset 8211:fd4091d53627 HEAD

Shared namespace: If we don't have a directory, return NULL instead of panicing. The callers are now expected to handle returned NULLs. In future some other non-filesystem based storages will probably also return NULLs.
author Timo Sirainen <tss@iki.fi>
date Mon, 22 Sep 2008 22:31:13 +0300
parents 1ea7d60cf39a
children 909ed7cd98a5
files src/lib-storage/index/shared/shared-list.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-list.c	Mon Sep 22 22:25:25 2008 +0300
+++ b/src/lib-storage/index/shared/shared-list.c	Mon Sep 22 22:31:13 2008 +0300
@@ -73,7 +73,7 @@
 {
 	struct mail_namespace *ns;
 
-	if (list->ns->storage == NULL ||
+	if (list->ns->storage == NULL || name == NULL ||
 	    shared_storage_get_namespace(list->ns->storage, &name, &ns) < 0) {
 		switch (type) {
 		case MAILBOX_LIST_PATH_TYPE_DIR:
@@ -84,8 +84,8 @@
 			/* we can safely say we don't use indexes */
 			return "";
 		}
-		i_panic("shared mailbox list: Can't return path for '%s'",
-			list->ns->prefix);
+		/* we don't have a directory we can use. */
+		return NULL;
 	}
 	return mailbox_list_get_path(ns->list, name, type);
 }