diff --git a/leetcode/cache_sqlite.go b/leetcode/cache_sqlite.go index d4cf044d..c2ce73ef 100644 --- a/leetcode/cache_sqlite.go +++ b/leetcode/cache_sqlite.go @@ -213,6 +213,9 @@ func (c *sqliteCache) GetBySlug(slug string) *QuestionData { if err != nil { return nil } + if len(q) == 0 { + return nil + } return q[0] } @@ -233,6 +236,9 @@ func (c *sqliteCache) GetById(id string) *QuestionData { if err != nil { return nil } + if len(q) == 0 { + return nil + } return q[0] }