mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-02 03:17:37 +03:00
listable: Fix incorrect unmarshaling of null to []T{null}
This commit is contained in:
parent
aa7d2543a3
commit
be9840c70f
1 changed files with 3 additions and 0 deletions
|
@ -18,6 +18,9 @@ func (l Listable[T]) MarshalJSONContext(ctx context.Context) ([]byte, error) {
|
|||
}
|
||||
|
||||
func (l *Listable[T]) UnmarshalJSONContext(ctx context.Context, content []byte) error {
|
||||
if string(content) == "null" {
|
||||
return nil
|
||||
}
|
||||
var singleItem T
|
||||
err := json.UnmarshalContextDisallowUnknownFields(ctx, content, &singleItem)
|
||||
if err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue