diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-12-07 20:09:50 +0000 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-12-07 20:09:50 +0000 |
commit | a3b009970fa6261337cbd5e9316d0d4f32ba5419 (patch) | |
tree | 73360784672dc4e54a9225ecdbc0ad6e959a76d6 | |
parent | ab8347aa55d5fa752284bccf02e5ca135110af71 (diff) | |
download | evolution-data-server-a3b009970fa6261337cbd5e9316d0d4f32ba5419.tar.gz |
Protect against either of the types being NULL.
2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-utils.c (header_content_type_simple): Protect against
either of the types being NULL.
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 8f479ca05..447ed596b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2001-12-04 Jeffrey Stedfast <fejj@ximian.com> + + * camel-mime-utils.c (header_content_type_simple): Protect against + either of the types being NULL. + 2001-12-05 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-filter-basic.c (filter): If complete() allocates diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 5efd2b088..247dca055 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -3141,9 +3141,19 @@ header_content_type_format(struct _header_content_type *ct) } char * -header_content_type_simple(struct _header_content_type *ct) +header_content_type_simple (struct _header_content_type *ct) { - return g_strdup_printf("%s/%s", ct->type, ct->subtype); + if (ct->type == NULL) { + w(g_warning ("Content-Type with no main type")); + return g_strdup ("text/plain"); + } else if (ct->subtype == NULL) { + w(g_warning ("Content-Type with no sub type: %s", ct->type)); + if (!strcasecmp (ct->type, "multipart")) + return g_strdup_printf ("%s/mixed", ct->type); + else + return g_strdup (ct->type); + } else + return g_strdup_printf ("%s/%s", ct->type, ct->subtype); } char * |