diff --git a/vmap/decoder.go b/vmap/decoder.go index 78163c3..1aae325 100644 --- a/vmap/decoder.go +++ b/vmap/decoder.go @@ -131,6 +131,7 @@ func (adBreak *AdBreak) UnmarshalToken(tok *xmltokenizer.Tokenizer, se *xmltoken case "VAST": var vast VAST if token.SelfClosing { + adBreak.AdSource.VASTData.VAST = &VAST{} break } // Reuse Token object in the sync.Pool since we only use it temporarily. diff --git a/vmap/structure_test.go b/vmap/structure_test.go index 27a2f28..88f8167 100644 --- a/vmap/structure_test.go +++ b/vmap/structure_test.go @@ -71,6 +71,7 @@ func TestDecodeVmapEmptyVast(t *testing.T) { is.NoErr(err) is.Equal(len(vmap.AdBreaks), 1) + is.Equal(len(vmap.AdBreaks[0].AdSource.VASTData.VAST.Ad), 0) } func TestDecodeEmptyVast(t *testing.T) {