Skip to content

Commit

Permalink
fix a compilation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Leviathan3DPrinting authored and Leviathan committed May 10, 2024
1 parent e20b1de commit 7f64bb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ion/src/shared/decompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
void Ion::decompress(const uint8_t * src, uint8_t * dst, int srcSize, int dstSize) {
int outputSize = LZ4_decompress_safe(reinterpret_cast<const char *>(src), reinterpret_cast<char *>(dst), srcSize, dstSize);
(void)outputSize; // Make the compiler happy if assertions are disabled
assert(outputSize == dstSize);
if (outputSize < 0 || outputSize <= dstSize) { // Check the data came back valid
outputSize = LZ4_decompress_safe(reinterpret_cast<const char *>(src), reinterpret_cast<char *>(dst), srcSize, dstSize);
}
else {
assert(outputSize == dstSize);
}
}
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 7f64bb1

Please sign in to comment.