From 10dc06be9bc9e085a83bd5c7fe6347eba6ee5c95 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 18 Sep 2023 19:23:10 +0200 Subject: [PATCH] Fix crash if `OpenAL` internal device name is all whitespaces --- Source/Engine/Core/Types/String.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Core/Types/String.cpp b/Source/Engine/Core/Types/String.cpp index e53f04af7..98b2c08dd 100644 --- a/Source/Engine/Core/Types/String.cpp +++ b/Source/Engine/Core/Types/String.cpp @@ -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)