From 91bf3ff3fc9977c6394d0ba733647cfa66b8bac9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 19 Aug 2016 12:44:44 +0200 Subject: [PATCH] Handle empty strings in marshalling (NULL elems and count == 0) --- renderdocui/Interop/CustomMarshaling.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renderdocui/Interop/CustomMarshaling.cs b/renderdocui/Interop/CustomMarshaling.cs index 365151210..1e711e6d6 100644 --- a/renderdocui/Interop/CustomMarshaling.cs +++ b/renderdocui/Interop/CustomMarshaling.cs @@ -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); }