Return an empty string on, er, empty string
This commit is contained in:
parent
f4c767259f
commit
c787ad8f8d
@ -91,6 +91,10 @@ namespace SDL2
|
|||||||
#else
|
#else
|
||||||
/* Old C# requires an extra memcpy, bleh! */
|
/* Old C# requires an extra memcpy, bleh! */
|
||||||
int len = (int) (ptr - (byte*) s);
|
int len = (int) (ptr - (byte*) s);
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
char* chars = stackalloc char[len];
|
char* chars = stackalloc char[len];
|
||||||
int strLen = System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);
|
int strLen = System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);
|
||||||
string result = new string(chars, 0, strLen);
|
string result = new string(chars, 0, strLen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user