diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-06 06:23:04 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-06 06:23:04 +0000 |
commit | 9bb800a49acaef0dc19916e5ae00c941292d2515 (patch) | |
tree | 4aee0dd046aa1af838209c81abe3af823b0c53a3 /libsylph | |
parent | cea367a9403bbc0da0ac4be390cb09a7b471c51b (diff) |
fixed a crash when printing a message with empty Subject, From, and To.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1266 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/codeconv.c | 16 | ||||
-rw-r--r-- | libsylph/procmsg.c | 15 |
2 files changed, 25 insertions, 6 deletions
diff --git a/libsylph/codeconv.c b/libsylph/codeconv.c index c05a1db5..6a16513c 100644 --- a/libsylph/codeconv.c +++ b/libsylph/codeconv.c @@ -1328,7 +1328,9 @@ void conv_code_converter_destroy(CodeConverter *conv) gchar *conv_convert(CodeConverter *conv, const gchar *inbuf) { - if (conv->code_conv_func != conv_noconv) + if (!inbuf) + return NULL; + else if (conv->code_conv_func != conv_noconv) return conv->code_conv_func(inbuf, NULL); else return conv_iconv_strdup @@ -1342,6 +1344,12 @@ gchar *conv_codeset_strdup_full(const gchar *inbuf, { CodeConvFunc conv_func; + if (!inbuf) { + if (error) + *error = 0; + return NULL; + } + src_encoding = conv_get_fallback_for_private_encoding(src_encoding); conv_func = conv_get_code_conv_func(src_encoding, dest_encoding); @@ -1486,6 +1494,12 @@ gchar *conv_iconv_strdup_with_cd(const gchar *inbuf, iconv_t cd, gint *error) size_t len; gint error_ = 0; + if (!inbuf) { + if (error) + *error = 0; + return NULL; + } + inbuf_p = inbuf; in_size = strlen(inbuf); in_left = in_size; diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 6d6b8bb2..3d69f015 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -1387,11 +1387,16 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline, body++; } - locale_str = conv_codeset_strdup - (body, CS_INTERNAL, conv_get_locale_charset_str()); - fprintf(prfp, "%s: %s\n", hdr->name, - locale_str ? locale_str : body); - g_free(locale_str); + if (body && *body != '\0') { + locale_str = conv_codeset_strdup + (body, CS_INTERNAL, + conv_get_locale_charset_str()); + fprintf(prfp, "%s: %s\n", hdr->name, + locale_str ? locale_str : body); + g_free(locale_str); + } else { + fprintf(prfp, "%s: (none)\n", hdr->name); + } } procheader_header_array_destroy(headers); |