From 5d3d8a60e946b8d4cf899b8d35488fd23108d6b9 Mon Sep 17 00:00:00 2001 From: Carl Lindqvist Date: Tue, 19 Aug 2025 10:54:27 +0200 Subject: [PATCH] Fill empty VAST data with empty VAST object instead of nil --- vmap/decoder.go | 1 + vmap/structure_test.go | 1 + 2 files changed, 2 insertions(+) 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) {