]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't crash if mail doesn't have any headers.
authorTimo Sirainen <tss@iki.fi>
Wed, 9 Apr 2003 20:07:47 +0000 (23:07 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 9 Apr 2003 20:07:47 +0000 (23:07 +0300)
--HG--
branch : HEAD

src/lib-imap/imap-envelope.c

index 7aa97f155df3f16612db6f5cf2a969f2a777a418..5b4474b6bfb6fcb8c79cc1a2fcbb6d22f36454bf 100644 (file)
@@ -85,6 +85,11 @@ void imap_envelope_parse_header(pool_t pool,
        struct message_address **addr_p;
        char **str_p;
 
+       if (*data == NULL) {
+               *data = p_new(pool, struct message_part_envelope_data, 1);
+               (*data)->pool = pool;
+       }
+
        if (hdr == NULL || !imap_envelope_get_field(hdr->name, &field))
                return;
 
@@ -94,12 +99,7 @@ void imap_envelope_parse_header(pool_t pool,
                return;
        }
 
-       if (*data == NULL) {
-               *data = p_new(pool, struct message_part_envelope_data, 1);
-               (*data)->pool = pool;
-       }
        d = *data;
-
        addr_p = NULL; str_p = NULL;
        switch (field) {
        case IMAP_ENVELOPE_DATE: