mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-03-04 21:59:41 +00:00
When a null C# string is passed to UTF8_ToNative(), return a null pointer instead of an empty C string.
This commit is contained in:
parent
ed4838b75d
commit
77cffe2f92
|
@ -44,10 +44,17 @@ namespace SDL2
|
|||
#region UTF8 Marshaling
|
||||
|
||||
internal static byte[] UTF8_ToNative(string s)
|
||||
{
|
||||
if (s != null)
|
||||
{
|
||||
// Add a null terminator. That's kind of it... :/
|
||||
return System.Text.Encoding.UTF8.GetBytes(s + '\0');
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue