aboutsummaryrefslogtreecommitdiff
path: root/hswg/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'hswg/main.go')
-rw-r--r--hswg/main.go4
1 files changed, 4 insertions, 0 deletions
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])