Make ToNative null check similar to ToManaged null check
This commit is contained in:
parent
77cffe2f92
commit
5ec50891a3
10
src/SDL2.cs
10
src/SDL2.cs
@ -45,15 +45,13 @@ namespace SDL2
|
|||||||
|
|
||||||
internal static byte[] UTF8_ToNative(string s)
|
internal static byte[] UTF8_ToNative(string s)
|
||||||
{
|
{
|
||||||
if (s != null)
|
if (s == null)
|
||||||
{
|
|
||||||
// Add a null terminator. That's kind of it... :/
|
|
||||||
return System.Text.Encoding.UTF8.GetBytes(s + '\0');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a null terminator. That's kind of it... :/
|
||||||
|
return System.Text.Encoding.UTF8.GetBytes(s + '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
|
internal static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user