From d7d7c3054e4822c418f1ca6ad119f6f05acfbea2 Mon Sep 17 00:00:00 2001 From: makeworld Date: Mon, 21 Dec 2020 12:42:43 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Don't=20panic=20when=20adding=20?= =?UTF-8?q?a=20feed/page=20for=20the=20first=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #151 --- CHANGELOG.md | 5 +++++ amfora.go | 2 +- subscriptions/subscriptions.go | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1baa3da..1165507f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.1] - 2020-12-21 +### Fixed +- Fixed bug that caused Amfora to crash when subscribing to a page (#151) + + ## [1.7.0] - 2020-12-20 ### Added - **Subscriptions** to feeds and page changes (#61) diff --git a/amfora.go b/amfora.go index 8ca3d559..6e5b80b5 100644 --- a/amfora.go +++ b/amfora.go @@ -11,7 +11,7 @@ import ( ) var ( - version = "v1.7.0" + version = "v1.7.1" commit = "unknown" builtBy = "unknown" ) diff --git a/subscriptions/subscriptions.go b/subscriptions/subscriptions.go index afea91c0..91535d3d 100644 --- a/subscriptions/subscriptions.go +++ b/subscriptions/subscriptions.go @@ -60,9 +60,12 @@ func Init() error { } else if !os.IsNotExist(err) { // There's an error opening the file, but it's not bc is doesn't exist return fmt.Errorf("open subscriptions.json error: %w", err) - } else { - // File does not exist, initialize maps + } + + if data.Feeds == nil { data.Feeds = make(map[string]*gofeed.Feed) + } + if data.Pages == nil { data.Pages = make(map[string]*pageJSON) }