Skip to content

Commit daa4805

Browse files
committed
Slightly improve perf in operator[]
1 parent d084b2f commit daa4805

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Core/GameEngine/Include/Common/UnicodeString.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ class UnicodeString
337337

338338
WideChar& operator[](Int index)
339339
{
340-
Int length = getLength();
341-
DEBUG_ASSERTCRASH(index >= 0 && index < length, ("bad index in UnicodeString::operator[]"));
342-
ensureUniqueBufferOfSize(length + 1, true, NULL, NULL);
340+
DEBUG_ASSERTCRASH(m_data && m_data->m_numCharsAllocated > index && index >= 0, ("bad index in UnicodeString::operator[]"));
341+
342+
ensureUniqueBufferOfSize(m_data->m_numCharsAllocated, true, NULL, NULL);
343343
return peek()[index];
344344
}
345345
};

0 commit comments

Comments
 (0)