cli/reply: check for NULL list first in scan_address_list()
authorJani Nikula <jani@nikula.org>
Tue, 13 Sep 2016 17:14:18 +0000 (20:14 +0300)
committerDavid Bremner <david@tethera.net>
Sat, 17 Sep 2016 12:08:58 +0000 (09:08 -0300)
Support passing NULL list later on. Also use it to simplify the
recursion.

notmuch-reply.c

index 9b78ea2c2b20ea20adafad20432d3a66341ead79..d90f46f9bed3f69fc5044ee934ce31585404094a 100644 (file)
@@ -192,6 +192,9 @@ scan_address_list (InternetAddressList *list,
     int i;
     unsigned int n = 0;
 
+    if (list == NULL)
+       return 0;
+
     for (i = 0; i < internet_address_list_length (list); i++) {
        address = internet_address_list_get_address (list, i);
        if (INTERNET_ADDRESS_IS_GROUP (address)) {
@@ -200,9 +203,6 @@ scan_address_list (InternetAddressList *list,
 
            group = INTERNET_ADDRESS_GROUP (address);
            group_list = internet_address_group_get_members (group);
-           if (group_list == NULL)
-               continue;
-
            n += scan_address_list (group_list, config, message, type, user_from);
        } else {
            InternetAddressMailbox *mailbox;