don't crash if we're passed a null value

This commit is contained in:
Michael Becker 2021-08-16 23:49:36 -04:00
parent b7e6cf895e
commit 714ea0aa58
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C

View File

@ -147,6 +147,9 @@ namespace UniversalEditor.IO
}
public void WriteFixedLengthString(string value, Encoding encoding)
{
if (value == null)
return;
byte[] data = encoding.GetBytes(value);
WriteBytes(data);
}
@ -175,6 +178,9 @@ namespace UniversalEditor.IO
[CLSCompliant(false)]
public void WriteFixedLengthString(string value, Encoding encoding, uint length, char paddingChar)
{
if (value == null)
return;
string v = value;
if (v == null) v = String.Empty;
byte[] data = encoding.GetBytes(v);