aboutsummaryrefslogtreecommitdiff
path: root/libsylph/codeconv.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-06 06:23:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-06 06:23:04 +0000
commit9bb800a49acaef0dc19916e5ae00c941292d2515 (patch)
tree4aee0dd046aa1af838209c81abe3af823b0c53a3 /libsylph/codeconv.c
parentcea367a9403bbc0da0ac4be390cb09a7b471c51b (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/codeconv.c')
-rw-r--r--libsylph/codeconv.c16
1 files changed, 15 insertions, 1 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;