Fix crash due to invalid message in Assimp

This commit is contained in:
Wojtek Figat
2023-09-19 14:00:37 +02:00
parent 2655dd12d6
commit 255e47fa1e
2 changed files with 11 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ void String::Set(const char* chars, int32 length)
}
_length = length;
}
if (chars)
if (chars && length)
StringUtils::ConvertANSI2UTF16(chars, _data, length, _length);
}

View File

@@ -42,7 +42,16 @@ public:
void write(const char* message) override
{
String s(message);
s.Replace('\n', ' ');
if (s.Length() <= 0)
return;
for (int32 i = 0; i < s.Length(); i++)
{
Char& c = s[i];
if (c == '\n')
c = ' ';
else if (c >= 255)
c = '?';
}
LOG(Info, "[Assimp]: {0}", s);
}
};