(str_nconvert_to_display, str_nconvert_to_input): handle invalid conversion.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Andrew Borodin 2024-09-13 12:29:37 +03:00 committed by Yury V. Zaytsev
parent 1e0e6b5e1e
commit 3526dfcf34

View File

@ -364,6 +364,8 @@ str_nconvert_to_display (const char *str, int len)
return g_string_new (str); return g_string_new (str);
conv = str_crt_conv_from (cp_source); conv = str_crt_conv_from (cp_source);
if (conv == INVALID_CONV)
return g_string_new (str);
buff = g_string_new (""); buff = g_string_new ("");
str_nconvert (conv, str, len, buff); str_nconvert (conv, str, len, buff);
@ -396,6 +398,8 @@ str_nconvert_to_input (const char *str, int len)
return g_string_new (str); return g_string_new (str);
conv = str_crt_conv_to (cp_source); conv = str_crt_conv_to (cp_source);
if (conv == INVALID_CONV)
return g_string_new (str);
buff = g_string_new (""); buff = g_string_new ("");
str_nconvert (conv, str, len, buff); str_nconvert (conv, str, len, buff);