File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,19 @@ public struct NbtOptions
10
10
IsBigEndian = true ,
11
11
IsVarArrayLength = false ,
12
12
IsVarStringLength = false ,
13
- MaxDepth = DefaultMaxDepth
13
+ MaxDepth = DefaultMaxDepth ,
14
+ TypeForEmptyList = NbtType . End ,
14
15
} ;
15
16
16
17
public bool IsBigEndian { get ; set ; }
17
18
public bool IsVarArrayLength { get ; set ; }
18
19
public bool IsVarStringLength { get ; set ; }
19
20
public int MaxDepth { get ; set ; }
21
+
22
+ /// <summary>
23
+ /// The expected type for empty list tags.
24
+ /// Can be <see langword="null"/> to skip validation.
25
+ /// </summary>
26
+ public NbtType ? TypeForEmptyList { get ; set ; }
20
27
}
21
28
}
Original file line number Diff line number Diff line change @@ -268,7 +268,8 @@ public NbtReadStatus TryRead()
268
268
269
269
if ( status != NbtReadStatus . Done )
270
270
goto ClearReturn ;
271
- if ( listLength <= 0 && listType != NbtType . End )
271
+ if ( listLength <= 0 &&
272
+ Options . TypeForEmptyList . HasValue && listType != Options . TypeForEmptyList . GetValueOrDefault ( ) )
272
273
{
273
274
status = NbtReadStatus . InvalidListLength ;
274
275
goto ClearReturn ;
You can’t perform that action at this time.
0 commit comments