[evolution-kolab] KolabMailImapClient: relax NULL foldername arg assertion in folder type query
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] KolabMailImapClient: relax NULL foldername arg assertion in folder type query
- Date: Wed, 12 Sep 2012 20:07:35 +0000 (UTC)
commit d442af9967fdac9741acf2bcf3e741fbab8d0701
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Wed Sep 12 22:03:37 2012 +0200
KolabMailImapClient: relax NULL foldername arg assertion in folder type query
* instead of stopping with an assertion failure when
presented with a NULL foldername argument or an
invalid folder type argument, we handle the case
gracefully by skipping that folder with a warning
* we may get a NULL foldername in the collection backend
when pre-3.6 Evolution data cannot successfully be
converted to 3.6 format (accounts, caches)
src/libekolab/kolab-mail-imap-client.c | 8 ++++++--
src/libekolabutil/kolab-util-folder.c | 6 +++---
2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/libekolab/kolab-mail-imap-client.c b/src/libekolab/kolab-mail-imap-client.c
index 6564e63..d69c114 100644
--- a/src/libekolab/kolab-mail-imap-client.c
+++ b/src/libekolab/kolab-mail-imap-client.c
@@ -1451,7 +1451,7 @@ kolab_mail_imap_client_get_folder_type (KolabMailImapClient *self,
GError *tmp_err = NULL;
g_assert (KOLAB_IS_MAIL_IMAP_CLIENT (self));
- g_assert (foldername != NULL);
+ g_return_val_if_fail (foldername != NULL, KOLAB_FOLDER_TYPE_INVAL);
/* cancellable may be NULL */
g_return_val_if_fail (err == NULL || *err == NULL, KOLAB_FOLDER_TYPE_INVAL);
@@ -1529,7 +1529,11 @@ kolab_mail_imap_client_query_folder_info_online (KolabMailImapClient *self,
} else {
desc = kolab_util_folder_descriptor_new (foldername,
type_id);
- folder_desc = g_list_prepend (folder_desc, desc);
+ if (desc != NULL)
+ folder_desc = g_list_prepend (folder_desc, desc);
+ else
+ g_warning ("%s()[%u]: NULL folder descriptor for folder '%s', type '%u'",
+ __func__, __LINE__, foldername, type_id);
}
folder_names_ptr = g_list_next (folder_names_ptr);
diff --git a/src/libekolabutil/kolab-util-folder.c b/src/libekolabutil/kolab-util-folder.c
index 0fdc80f..f781b27 100644
--- a/src/libekolabutil/kolab-util-folder.c
+++ b/src/libekolabutil/kolab-util-folder.c
@@ -184,9 +184,9 @@ kolab_util_folder_descriptor_new (const gchar *foldername,
{
KolabFolderDescriptor *desc = NULL;
- g_assert (foldername != NULL);
- g_assert ((type_id > KOLAB_FOLDER_TYPE_INVAL) &&
- (type_id < KOLAB_FOLDER_LAST_TYPE));
+ g_return_val_if_fail (foldername != NULL, NULL);
+ g_return_val_if_fail ((type_id > KOLAB_FOLDER_TYPE_INVAL) &&
+ (type_id < KOLAB_FOLDER_LAST_TYPE), NULL);
desc = g_new0 (KolabFolderDescriptor, 1);
desc->name = g_strdup (foldername);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]