From dd1d5bf6136e9d14886e750f260ecf0478b994b2 Mon Sep 17 00:00:00 2001 From: kaa Date: Mon, 2 Sep 2024 13:00:54 -0700 Subject: Check if there are any authors to speak of, instead of failing. --- sift.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sift.go') diff --git a/sift.go b/sift.go index 284a8fa..fdd01fd 100644 --- a/sift.go +++ b/sift.go @@ -107,14 +107,16 @@ func main() { } } - authorsMap := m["authors"].([]interface{}) - for i, author := range authorsMap { - authorText := author.(string) - if i > 0 { - authors += " & " - authors += authorText - } else { - authors = authorText + if m["authors"] != nil { + authorsMap := m["authors"].([]interface{}) + for i, author := range authorsMap { + authorText := author.(string) + if i > 0 { + authors += " & " + authors += authorText + } else { + authors = authorText + } } } -- cgit v1.2.3