From 2cbd724eff35de9126e3cce9f4ef0e380acb0691 Mon Sep 17 00:00:00 2001 From: Ivan Mogilko Date: Fri, 3 Nov 2023 16:51:52 +0300 Subject: [PATCH] Engine: fixed String.Substring() --- Engine/ac/string.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/ac/string.cpp b/Engine/ac/string.cpp index ce0e0caa485..820e7cc3b7a 100644 --- a/Engine/ac/string.cpp +++ b/Engine/ac/string.cpp @@ -115,7 +115,7 @@ const char* String_Substring(const char *thisString, int index, int length) { size_t end = uoffset(thisString + start, sublen) + start; size_t copylen = end - start; - auto buf = ScriptString::CreateBuffer(copylen, length); // arg is a text length + auto buf = ScriptString::CreateBuffer(copylen, sublen); memcpy(buf.Get(), thisString + start, copylen); buf.Get()[copylen] = 0; return CreateNewScriptString(std::move(buf));