Skip to content

Commit

Permalink
[Ion] Prevent crash if locale is null (UpsilonNumworks#365)
Browse files Browse the repository at this point in the history
* fix a compilation issue

* revert file

---------

Co-authored-by: Leviathan3DPrinting <[email protected]>
  • Loading branch information
Leviathan3DPrinting and Leviathan3DPrinting authored May 12, 2024
1 parent 891693a commit ac71576
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ion/src/simulator/linux/platform_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ac71576

Please sign in to comment.