Skip to content

Commit

Permalink
Fix invalid qid sqlite panic
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Jan 28, 2023
1 parent 77d1b71 commit 84b7a5a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions leetcode/cache_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}

Expand All @@ -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]
}

Expand Down

0 comments on commit 84b7a5a

Please sign in to comment.