[evolution-ews] Runtime warnings when calling ResolveNames



commit 5e7e8913f48c230290be9bc10d8822bd72da0fc3
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 24 22:40:53 2016 +0200

    Runtime warnings when calling ResolveNames
    
    It can be that the ResolveNames response contain only mailboxes, but
    no contacts, for which is a comment written in the code, but the code
    doesn't reflect it and can cause runtime warnings when the contacts
    are not returned by the server.

 src/addressbook/e-book-backend-ews.c |    2 +-
 src/server/e-ews-connection.c        |   14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index be30279..9ca7da9 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -3525,7 +3525,7 @@ e_book_backend_ews_start_view (EBookBackend *backend,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
  out:
        e_data_book_view_notify_complete (book_view, error);
        g_clear_error (&error);
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 27d527e..46392e5 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1264,8 +1264,12 @@ ews_handle_resolution_set_param (ESoapParameter *subparam,
                        /* 'mailboxes' and 'contact_items' match 1:1, but if the contact information
                         * wasn't found, then NULL is stored in the corresponding position */
                        node = e_soap_parameter_get_first_child_by_name (subparam, "Contact");
-                       contact_item = e_ews_item_new_from_soap_parameter (node);
-                       contact_items = g_slist_prepend (contact_items, contact_item);
+                       if (node) {
+                               contact_item = e_ews_item_new_from_soap_parameter (node);
+                               contact_items = g_slist_prepend (contact_items, contact_item);
+                       } else {
+                               contact_items = g_slist_prepend (contact_items, NULL);
+                       }
                }
        }
 
@@ -5199,7 +5203,7 @@ e_ews_connection_resolve_names_finish (EEwsConnection *cnc,
        if (contact_items)
                *contact_items = async_data->items_created;
        else
-               g_slist_free_full (async_data->items_created, g_object_unref);
+               e_util_free_nullable_object_slist (async_data->items_created);
        *mailboxes = async_data->items;
 
        return TRUE;
@@ -5330,7 +5334,7 @@ ews_connection_resolve_by_name (EEwsConnection *cnc,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
 }
 
 gboolean
@@ -5385,7 +5389,7 @@ e_ews_connection_ex_to_smtp_sync (EEwsConnection *cnc,
        }
 
        g_slist_free_full (mailboxes, (GDestroyNotify) e_ews_mailbox_free);
-       g_slist_free_full (contacts, g_object_unref);
+       e_util_free_nullable_object_slist (contacts);
 
        if (!*smtp_address) {
                const gchar *usename;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]