Make ToNative null check similar to ToManaged null check

master
Ethan Lee 2018-01-15 21:57:30 -05:00
parent 77cffe2f92
commit 5ec50891a3
1 changed files with 4 additions and 6 deletions

View File

@ -45,15 +45,13 @@ namespace SDL2
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
if (s == 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)