mirror of https://github.com/dahall/Vanara.git
Added null handler to MarshalToPtr
parent
72a2ceb50c
commit
6a46bd4c96
|
@ -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>
|
/// <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)
|
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 stSize = Marshal.SizeOf(typeof(T));
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
|
|
Loading…
Reference in New Issue