summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaa <kaa@disroot.org>2024-09-02 13:00:54 -0700
committerkaa <kaa@disroot.org>2024-09-02 13:00:54 -0700
commitdd1d5bf6136e9d14886e750f260ecf0478b994b2 (patch)
tree16f275386a47a515762d7616d3b7a66ba5447238
parentad391f572ee7272895f63d47a4231b282a50f7d0 (diff)
Check if there are any authors to speak of, instead of failing.
-rw-r--r--sift.go18
1 files changed, 10 insertions, 8 deletions
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
+ }
}
}