From 9e90ada9bc2c55e038f417ae9aa8ef47c1ca37a6 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 14 Oct 2010 21:47:48 +0200 Subject: [PATCH] Avoid a crash in g_convert () if iconv_open () fails. --- eglib/src/gunicode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eglib/src/gunicode.c b/eglib/src/gunicode.c index af117744464..64315a4f081 100644 --- a/eglib/src/gunicode.c +++ b/eglib/src/gunicode.c @@ -217,8 +217,10 @@ g_convert (const gchar *str, gssize len, convertor = iconv_open (to_codeset, from_codeset); if (convertor == (iconv_t) -1){ - *bytes_written = 0; - *bytes_read = 0; + if (bytes_written) + *bytes_written = 0; + if (bytes_read) + *bytes_read = 0; return NULL; } -- GitLab