Added null handler to MarshalToPtr

pull/60/head
David Hall 2019-03-13 09:56:21 -06:00
parent 72a2ceb50c
commit 6a46bd4c96
1 changed files with 1 additions and 0 deletions

View File

@ -105,6 +105,7 @@ namespace Vanara.Extensions
/// <param name="prefixBytes">The number of bytes to skip before writing the first element of <paramref name="items"/>.</param>
public static void MarshalToPtr<T>(this IEnumerable<T> items, IntPtr ptr, int prefixBytes = 0)
{
if (items is null) return;
var stSize = Marshal.SizeOf(typeof(T));
var i = 0;
foreach (var item in items)