diff --git a/ion/src/simulator/linux/platform_language.cpp b/ion/src/simulator/linux/platform_language.cpp index 81a370de320..58442afe545 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;