aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-10-02 17:06:55 +0800
committerRunxi Yu <me@runxiyu.org>2024-10-02 17:06:55 +0800
commitf4483729eed98be55520baa85c5d23bc53a5e283 (patch)
tree57a1503c124422b11a629aa84229d0ad777fa9e3
parentCheck errors and simplify (diff)
downloadrssmail-master.tar.gz
rssmail-master.zip
main.go: Fail gracefully on empty feed.ItemsHEADmaster
-rw-r--r--main.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.go b/main.go
index 8a7c347..ae544ee 100644
--- a/main.go
+++ b/main.go
@@ -40,6 +40,10 @@ func main() {
last_time := time.Unix(last_int64, 0)
fp := gofeed.NewParser()
feed, _ := fp.ParseURL(rss_url)
+ if feed.Items == nil {
+ fmt.Fprintf(os.Stderr, "no feed items???\n")
+ return
+ }
for i := len(feed.Items) - 1; i >= 0; i-- {
item := feed.Items[i]
title := html2text.HTML2Text(item.Title)