Merge pull request #64 from PepperDash/feature/add-xsig-classes

Fix null ref exception for XSigSerialToken
This commit is contained in:
Andrew Welker
2020-09-30 16:43:24 -06:00
committed by GitHub

View File

@@ -29,7 +29,8 @@ namespace PepperDash.Core.Intersystem.Tokens
public override byte[] GetBytes()
{
var serialBytes = Encoding.GetEncoding(28591).GetBytes(Value);
var serialBytes = String.IsNullOrEmpty(Value) ? new byte[0] : Encoding.GetEncoding(28591).GetBytes(Value);
var xsig = new byte[serialBytes.Length + 3];
xsig[0] = (byte)(0xC8 | (Index >> 7));
xsig[1] = (byte)((Index - 1) & 0x7F);