Skip to content

Commit 1b50266

Browse files
committed
Fix String::create(_, 0) without HX_SMART_STRINGS
When smart strings are enabled, this always returns an empty string, however, if they are disabled this currently has different behaviour depending on the type of character passed in. This fixes the behaviour so that it also returns an empty string for wchar_t and char16_t strings when smart strings are disabled.
1 parent 7911676 commit 1b50266

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/String.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ inline String TCopyString(const T *inString,int inLength)
454454
}
455455
else
456456
{
457+
if (inLength == 0) {
458+
return String::emptyString;
459+
}
457460
int length = inLength > 0 ? inLength : 0;
458461
const char *ptr = TConvertToUTF8(inString, &length, 0, true );
459462
return String(ptr,length);

0 commit comments

Comments
 (0)