aboutsummaryrefslogtreecommitdiff
path: root/libsylph/codeconv.c
diff options
context:
space:
mode:
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;