If namespaces==NULL, this function isn't even supposed to be called.
struct mail_namespace *
mail_namespace_find_inbox(struct mail_namespace *namespaces)
{
- while ((namespaces->flags & NAMESPACE_FLAG_INBOX_USER) == 0)
+ i_assert(namespaces != NULL);
+
+ /* there should always be an INBOX */
+ while ((namespaces->flags & NAMESPACE_FLAG_INBOX_USER) == 0) {
namespaces = namespaces->next;
+ i_assert(namespaces != NULL);
+ }
return namespaces;
}
struct mail_namespace *
mail_namespace_find_unsubscribable(struct mail_namespace *namespaces,
const char *mailbox);
-/* Returns the INBOX namespace, or NULL if there is no such */
+/* Returns the INBOX namespace. It always exists, so NULL is never returned. */
struct mail_namespace *
mail_namespace_find_inbox(struct mail_namespace *namespaces);
/* Find a namespace with given prefix. */