diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2001-02-15 08:09:26 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2001-02-15 08:09:26 +0000 |
commit | 8f49975c173132293ea86d073e6c20a264d3f17f (patch) | |
tree | a9a26f3be81419d53d642fb84de9ab60f565df31 /charset.c | |
parent | fd17042aae5a0a4a17ce41eec6762f369669a178 (diff) |
Fix iconv-hook. It would segfault with x-unknown and other
problematic cases.
Diffstat (limited to 'charset.c')
-rw-r--r-- | charset.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -305,6 +305,7 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags) { char tocode1[SHORT_STRING]; char fromcode1[SHORT_STRING]; + char *tocode2, *fromcode2; char *tmp; iconv_t cd; @@ -319,8 +320,10 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags) if ((cd = iconv_open (tocode1, fromcode1)) != (iconv_t) -1) return cd; - /* else */ - return iconv_open (mutt_iconv_hook (tocode1), mutt_iconv_hook (fromcode1)); + if ((tocode2 = mutt_iconv_hook (tocode1)) && (fromcode2 = mutt_iconv_hook (fromcode1))) + return iconv_open (tocode2, fromcode2); + + return (iconv_t) -1; } |