Don't try to output anything if item collection is empty

This commit is contained in:
Marius Orcsik 2022-05-29 15:19:53 +02:00
parent f32e7aa1f4
commit 897ab70990
No known key found for this signature in database
GPG key ID: DBF5E47F5DBC4D21

View file

@ -35,6 +35,9 @@ func (i ItemCollection) IsObject() bool {
// MarshalJSON encodes the receiver object to a JSON document.
func (i ItemCollection) MarshalJSON() ([]byte, error) {
if i == nil {
return nil, nil
}
b := make([]byte, 0)
writeItemCollectionJSONValue(&b, i)
return b, nil