1
0
Fork 0

🐛 Fix: lagi: Don't close iconv_t if it is iconv_invalid

When certain iconv_t is invalid, iconv_invalid(0xfffffffffffffffffffffff) will be returned. Passing it to iconv_close will cause a SIGSEGV.
This commit is contained in:
Charlie Jiang 2019-10-06 23:47:53 +08:00 committed by wangqr
parent 71894fd769
commit a2fc4bf479
1 changed files with 1 additions and 1 deletions

View File

@ -420,7 +420,7 @@ size_t IconvWrapper::DstStrLen(const char* str) {
bool IsConversionSupported(const char *src, const char *dst) {
iconv_t cd = iconv_open(dst, src);
bool supported = cd != iconv_invalid;
iconv_close(cd);
if (supported) iconv_close(cd);
return supported;
}