From 939408a4322069bdb6dedb94225231f3396ea0bc Mon Sep 17 00:00:00 2001 From: Chad Clark Date: Fri, 15 Nov 2024 11:23:20 -0700 Subject: [PATCH] fix(podcast): nil pointer when podcast has no image --- podcast/podcast.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/podcast/podcast.go b/podcast/podcast.go index 0cf37326..747b0844 100644 --- a/podcast/podcast.go +++ b/podcast/podcast.go @@ -82,11 +82,14 @@ func (p *Podcasts) AddNewPodcast(rssURL string, feed *gofeed.Feed) (*db.Podcast, } podcast := db.Podcast{ Description: feed.Description, - ImageURL: feed.Image.URL, + ImageURL: "", Title: feed.Title, URL: rssURL, RootDir: rootDir, } + if feed.Image != nil { + podcast.ImageURL = feed.Image.URL + } if err := os.Mkdir(podcast.RootDir, 0o755); err != nil && !os.IsExist(err) { return nil, err }