Make consistent with other deserializers

This commit is contained in:
Matt Nadareski
2025-09-24 09:27:24 -04:00
parent b97dbc2ac5
commit b6acde9145
2 changed files with 6 additions and 3 deletions

View File

@@ -140,14 +140,13 @@ namespace SabreTools.Serialization.Test.Deserializers
[Theory]
[InlineData(new byte[] { 0x26, 0x80 })]
[InlineData(new byte[] { 0x26, 0x89 })]
public void ComplexValueInvalidLength_Empty(byte[] arr)
public void ComplexValueInvalidLength_Null(byte[] arr)
{
Stream data = new MemoryStream(arr);
var deserializer = new AbstractSyntaxNotationOne();
var actual = deserializer.Deserialize(data);
Assert.NotNull(actual);
Assert.Empty(actual);
Assert.Null(actual);
}
}
}

View File

@@ -29,6 +29,10 @@ namespace SabreTools.Serialization.Deserializers
topLevelValues.Add(topLevelValue);
}
// Return null instead of empty
if (topLevelValues.Count == 0)
return null;
// Return the top-level values
return [.. topLevelValues];
}