~glorifiedgluer/openring

b0904bf2aec676a04ca94e6d581e0a6cdf4861ef — Simon Ser 5 years ago 606f7b6
Fix panic when too few feeds are retrieved

    panic: runtime error: slice bounds out of range

    goroutine 1 [running]:
    main.main()
    	/home/simon/src/openring/openring.go:121 +0xef4
    exit status 2
1 files changed, 3 insertions(+), 0 deletions(-)

M openring.go
M openring.go => openring.go +3 -0
@@ 118,6 118,9 @@ func main() {
	sort.Slice(articles, func(i, j int) bool {
		return articles[i].Date.After(articles[j].Date)
	})
	if len(articles) < narticles {
		narticles = len(articles)
	}
	articles = articles[:narticles]
	err = tmpl.Execute(os.Stdout, struct{
		Articles []*Article