From 194bc48d1bc7a9d35a65b596665e7e62f3f50d02 Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Sat, 4 May 2024 00:40:46 +0800 Subject: [PATCH] fix: add a cache empty warning --- leetcode/cache_json.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/leetcode/cache_json.go b/leetcode/cache_json.go index 1afffec4..486425e2 100644 --- a/leetcode/cache_json.go +++ b/leetcode/cache_json.go @@ -69,6 +69,10 @@ func (c *jsonCache) load() { log.Error("failed to load cache, try updating with `leetgo cache update`", "err", err) return } + if len(c.slugs) == 0 { + log.Warn("cache is empty, try updating with `leetgo cache update`") + return + } if c.Outdated() { log.Warn("cache is too old, try updating with `leetgo cache update`") }