Fix crash if OpenAL internal device name is all whitespaces

This commit is contained in:
Wojtek Figat
2023-09-18 19:23:10 +02:00
parent c4b22b2120
commit 10dc06be9b

View File

@@ -298,8 +298,10 @@ String String::TrimTrailing() const
end--;
}
ASSERT_LOW_LAYER(end >= start);
return Substring(start, end - start + 1);
const int32 count = end - start + 1;
if (start >= 0 && start + count <= Length() && count >= 0)
return String(_data + start, count);
return Empty;
}
String& String::operator/=(const Char* str)