From 5ec50891a32a27ff707cc5760bf400e30b215045 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 15 Jan 2018 21:57:30 -0500 Subject: [PATCH] Make ToNative null check similar to ToManaged null check --- src/SDL2.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index cfbf245..ce6ad79 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -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)