From ab2af62cb04b6e023ea449c46a943de7af905056 Mon Sep 17 00:00:00 2001 From: Vladimir Zagainov Date: Sun, 19 Jul 2026 21:08:57 +0300 Subject: [PATCH] fix: guard against whitespace-only type attribute panic in ParseReleaseGroups --- internal/musicbrainz/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/musicbrainz/client.go b/internal/musicbrainz/client.go index 5ee2bc6..cfd9166 100644 --- a/internal/musicbrainz/client.go +++ b/internal/musicbrainz/client.go @@ -148,7 +148,9 @@ func ParseReleaseGroups(data []byte) (*ParsedReleaseGroups, error) { // so take the first token as the primary type. primary := rg.PrimaryType if primary == "" && rg.TypeAttr != "" { - primary = strings.Fields(rg.TypeAttr)[0] + if fields := strings.Fields(rg.TypeAttr); len(fields) > 0 { + primary = fields[0] + } } result.ReleaseGroups = append(result.ReleaseGroups, ReleaseGroup{ ID: rg.ID,