From 1d0fbff006b4a12e24275486a69156fb437ef5ab Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Mon, 19 Aug 2019 19:48:58 +0300 Subject: [PATCH] Handle feed items without images --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 3160501..ac8f977 100644 --- a/main.go +++ b/main.go @@ -47,11 +47,13 @@ func main() { itemDetailsPath, GrabFeedItemJSON(item)) - itemImagePath := itemOutputDir + "/image" + RemoveGetParams(filepath.Ext(item.Image.URL)) - LogInfo("Downloading image to " + itemImagePath) - DownloadFile( - itemImagePath, - item.Image.URL) + if item.Image != nil { + itemImagePath := itemOutputDir + "/image" + RemoveGetParams(filepath.Ext(item.Image.URL)) + LogInfo("Downloading image to " + itemImagePath) + DownloadFile( + itemImagePath, + item.Image.URL) + } for _, enclosure := range item.Enclosures { filename := RemoveGetParams(filepath.Base(enclosure.URL))