From 7a2ea02c8d5c96c70f6d7098d316b12c00e7c9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 28 Feb 2022 05:02:17 +0100 Subject: hswg: make AttrList return nil for missing attrs And update copyright years. --- hswg/main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'hswg/main.go') diff --git a/hswg/main.go b/hswg/main.go index e4b557f..88ed486 100644 --- a/hswg/main.go +++ b/hswg/main.go @@ -49,6 +49,10 @@ func (m *Metadata) Attr(name string) string { // AttrList is similar to Attr, but splits the result at commas, // and trims whitespace around array elements. func (m *Metadata) AttrList(name string) []string { + if !m.Attributes.Has(name) { + return nil + } + res := strings.Split(m.Attr(name), ",") for i := range res { res[i] = strings.TrimSpace(res[i]) -- cgit v1.2.3