Return an empty string on, er, empty string

This commit is contained in:
Ethan Lee 2019-05-29 16:54:26 -04:00
parent f4c767259f
commit c787ad8f8d

View file

@ -91,6 +91,10 @@ namespace SDL2
#else
/* Old C# requires an extra memcpy, bleh! */
int len = (int) (ptr - (byte*) s);
if (len == 0)
{
return string.Empty;
}
char* chars = stackalloc char[len];
int strLen = System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);
string result = new string(chars, 0, strLen);