Browse Source

Merge pull request #10 from Katori/patch-1

Don't attempt to copy if Data is null
Coburn 5 years ago
parent
commit
7c77216174
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Source/Managed/ENet.cs

+ 5 - 2
Source/Managed/ENet.cs

@@ -400,7 +400,10 @@ namespace ENet
         {
             if (destination == null)
                 throw new ArgumentNullException("destination");
-
+            if (Data == null)
+            {
+                return;
+            }
             Marshal.Copy(Data, destination, 0, Length);
         }
     }
@@ -1191,4 +1194,4 @@ namespace ENet
         [DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
         internal static extern void enet_peer_reset(IntPtr peer);
     }
-}
+}