aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-06-20 23:22:41 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-06-20 23:22:41 +0200
commit2d613acd5163c7654506af1e64efefb9ca188c4a (patch)
tree77a3c188d75c8ee6691d0f63e8c7f805984b8e7c
parenteefdc799b929a4d6407737d281c34dd940e2823f (diff)
downloadfeed2imap-go-2d613acd5163c7654506af1e64efefb9ca188c4a.tar.gz
feed2imap-go-2d613acd5163c7654506af1e64efefb9ca188c4a.tar.bz2
feed2imap-go-2d613acd5163c7654506af1e64efefb9ca188c4a.zip
Fixes a bug where cached items get deleted when the feed is empty
-rw-r--r--internal/feed/cache_v1.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/feed/cache_v1.go b/internal/feed/cache_v1.go
index b5d6b3e..656c133 100644
--- a/internal/feed/cache_v1.go
+++ b/internal/feed/cache_v1.go
@@ -85,8 +85,10 @@ func (cf *cachedFeed) Checked(withFailure bool) {
}
func (cf *cachedFeed) Commit() {
- cf.Items = cf.newItems
- cf.newItems = nil
+ if cf.newItems != nil {
+ cf.Items = cf.newItems
+ cf.newItems = nil
+ }
cf.LastCheck = cf.currentCheck
}