From 6971813c1ecfb51ecdd49a19ed6471c0680973e2 Mon Sep 17 00:00:00 2001 From: Saikari Date: Sat, 17 Jan 2026 09:56:27 +0300 Subject: wrap --- core/src/xmake/string/case.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/xmake/string/case.c b/core/src/xmake/string/case.c index 777148623..28212a389 100644 --- a/core/src/xmake/string/case.c +++ b/core/src/xmake/string/case.c @@ -69,7 +69,8 @@ static tb_int_t xm_string_case(lua_State* lua, tb_bool_t lower) { // attempt to set utf-8 locale for towlower/towupper // we need this on some platforms like DragonFly BSD, because towlower/towupper depends on the current locale #ifdef TB_CONFIG_LIBC_HAVE_SETLOCALE - tb_char_t* old_locale = tb_strdup(setlocale(LC_ALL, tb_null)); + tb_char_t const* old_locale_str = setlocale(LC_ALL, tb_null); + tb_char_t* old_locale = old_locale_str? tb_strdup(old_locale_str) : tb_null; tb_setlocale(); #endif tb_size_t i = 0; -- cgit v1.3.1