From c00270cf01e452d4b6d315c9ee880dd6a8ae7522 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 23 Aug 2023 10:18:11 +0800 Subject: [PATCH] :bug: Unable to open the doc when the block pointed by the scroll position does not exist Fix https://github.com/siyuan-note/siyuan/issues/9030 --- kernel/model/file.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/model/file.go b/kernel/model/file.go index 2962d5e03..7d30f9179 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -516,8 +516,12 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s luteEngine := NewLute() node := treenode.GetNodeInTree(tree, id) if nil == node { - err = ErrBlockNotFound - return + // Unable to open the doc when the block pointed by the scroll position does not exist https://github.com/siyuan-note/siyuan/issues/9030 + node = treenode.GetNodeInTree(tree, tree.Root.ID) + if nil == node { + err = ErrBlockNotFound + return + } } if isBacklink { // 引用计数浮窗请求,需要按照反链逻辑组装 https://github.com/siyuan-note/siyuan/issues/6853