don't crash if we get passed NULL array

This commit is contained in:
Michael Becker 2019-12-22 15:21:02 -05:00
parent a6785cf7cf
commit 1d56893e99
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -58,6 +58,7 @@ namespace UniversalEditor.IO
public void WriteFixedLengthBytes(byte[] data, int count)
{
if (data == null) data = new byte[0];
byte[] realdata = new byte[count];
Array.Copy(data, 0, realdata, 0, Math.Min(realdata.Length, count));
WriteBytes(realdata);