Skip to content

Commit

Permalink
imapc: Allow using LAYOUT=none without crashing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and GitLab committed Jan 30, 2017
1 parent e5d2061 commit 64a3686
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/lib-storage/index/imapc/imapc-list.c
Expand Up @@ -390,7 +390,7 @@ static struct mailbox_list *imapc_list_get_fs(struct imapc_mailbox_list *list)
if (dir == NULL)
dir = list->list.set.root_dir;

if (dir == NULL) {
if (dir == NULL || dir[0] == '\0') {
/* indexes disabled */
} else if (list->index_list == NULL && !list->index_list_failed) {
mailbox_list_settings_init_defaults(&list_set);
Expand Down Expand Up @@ -937,6 +937,11 @@ int imapc_list_get_mailbox_flags(struct mailbox_list *_list, const char *name,
i_assert(list->refreshed_mailboxes_recently);
}

if (list->mailboxes == NULL) {
/* imapc list isn't used, but e.g. LAYOUT=none */
*flags_r = 0;
return 0;
}
node = mailbox_tree_lookup(list->mailboxes, vname);
if (node == NULL)
*flags_r = MAILBOX_NONEXISTENT;
Expand Down
3 changes: 2 additions & 1 deletion src/lib-storage/index/imapc/imapc-storage.c
Expand Up @@ -424,7 +424,8 @@ static void
imapc_storage_get_list_settings(const struct mail_namespace *ns ATTR_UNUSED,
struct mailbox_list_settings *set)
{
set->layout = MAILBOX_LIST_NAME_IMAPC;
if (set->layout == NULL)
set->layout = MAILBOX_LIST_NAME_IMAPC;
set->escape_char = IMAPC_LIST_ESCAPE_CHAR;
}

Expand Down

0 comments on commit 64a3686

Please sign in to comment.