diff --git a/src/SDL2.cs b/src/SDL2.cs index 1b64646..cfbf245 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -45,8 +45,15 @@ namespace SDL2 internal static byte[] UTF8_ToNative(string s) { - // Add a null terminator. That's kind of it... :/ - return System.Text.Encoding.UTF8.GetBytes(s + '\0'); + 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)