mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2024-12-22 23:25:40 +00:00
Return an empty string on, er, empty string
This commit is contained in:
parent
f4c767259f
commit
c787ad8f8d
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue