From 192679eeddef118a2257b8259bc8c7f09d087f57 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 29 Dec 2022 22:00:07 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=8D=A1=E5=8C=85=E5=86=85=E7=9A=84=E9=97=AA=E5=8D=A1=20https:?= =?UTF-8?q?//github.com/siyuan-note/siyuan/issues/6943?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/flashcard.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go index 8051c8c17..6c6c3f211 100644 --- a/kernel/model/flashcard.go +++ b/kernel/model/flashcard.go @@ -41,6 +41,7 @@ var Decks = map[string]*riff.Deck{} var deckLock = sync.Mutex{} func GetFlashcards(deckID string, page int) (blockIDs []string, total, pageCount int) { + blockIDs = []string{} deck := Decks[deckID] if nil == deck { return @@ -64,6 +65,9 @@ func GetFlashcards(deckID string, page int) (blockIDs []string, total, pageCount blockIDs = allBlockIDs[start:end] total = len(allBlockIDs) pageCount = int(math.Ceil(float64(total) / float64(pageSize))) + if 1 > len(blockIDs) { + blockIDs = []string{} + } return }