From 7df94bef127d75fe865b50976986ade43805e0f7 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 20 Aug 2023 03:20:49 +0400 Subject: [PATCH] Only then call make on cache if it is nil. --- internal/radio/icecast.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/radio/icecast.go b/internal/radio/icecast.go index a22cb3c..362b969 100644 --- a/internal/radio/icecast.go +++ b/internal/radio/icecast.go @@ -183,7 +183,9 @@ func (pw *PlaylistLogWatcher) Watch(playlistPath string, n int) (err error) { pw.watcher.WatchForMask(pw.changed, watcher.ModIgnMask) - lastPlayedCache = make([]Song, 0, n) + if lastPlayedCache == nil { + lastPlayedCache = make([]Song, 0, n) + } go func() { for {