Handle empty strings in marshalling (NULL elems and count == 0)

This commit is contained in:
baldurk
2016-08-19 12:44:44 +02:00
parent d2faf76356
commit 91bf3ff3fc
+2 -1
View File
@@ -403,7 +403,8 @@ namespace renderdoc
public static string PtrToStringUTF8(IntPtr elems, int count)
{
byte[] buffer = new byte[count];
Marshal.Copy(elems, buffer, 0, buffer.Length);
if (count > 0)
Marshal.Copy(elems, buffer, 0, buffer.Length);
return System.Text.Encoding.UTF8.GetString(buffer);
}