From ac71576accd4fef74d74e417c3ff94507d78be79 Mon Sep 17 00:00:00 2001 From: Leviathan3DPrinting <18338698+Leviathan3DPrinting@users.noreply.github.com> Date: Sun, 12 May 2024 06:35:12 -0500 Subject: [PATCH] [Ion] Prevent crash if locale is null (#365) * fix a compilation issue * revert file --------- Co-authored-by: Leviathan3DPrinting --- ion/src/simulator/linux/platform_language.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/linux/platform_language.cpp b/ion/src/simulator/linux/platform_language.cpp index 81a370de3..58442afe5 100644 --- a/ion/src/simulator/linux/platform_language.cpp +++ b/ion/src/simulator/linux/platform_language.cpp @@ -8,7 +8,7 @@ namespace Platform { const char * languageCode() { static char buffer[3] = {0}; char * locale = setlocale(LC_ALL, ""); - if (locale[2] == '_') { + if (locale && locale[2] == '_') { // Check if locale is not null before accessing its elements buffer[0] = locale[0]; buffer[1] = locale[1]; return buffer;