summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-01-17 09:56:27 +0300
committerSaikari <[email protected]>2026-01-17 09:56:27 +0300
commit6971813c1ecfb51ecdd49a19ed6471c0680973e2 (patch)
tree03aa36d47c092615a241aa071a2f4fc2ee095564 /core/src
parent2ee21af12eaf85d32d36570c8189c581f59fb3c9 (diff)
wrap
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/string/case.c3
1 files changed, 2 insertions, 1 deletions
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;