mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
Make consistent with other deserializers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user