mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🐛 Fix NPE
This commit is contained in:
parent
1ec54282c7
commit
973f99b690
2 changed files with 12 additions and 0 deletions
|
|
@ -483,6 +483,10 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChild
|
||||||
}
|
}
|
||||||
paragraphParents := sql.GetBlocks(paragraphParentIDs)
|
paragraphParents := sql.GetBlocks(paragraphParentIDs)
|
||||||
for _, p := range paragraphParents {
|
for _, p := range paragraphParents {
|
||||||
|
if nil == p {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if "i" == p.Type || "h" == p.Type {
|
if "i" == p.Type || "h" == p.Type {
|
||||||
linkRefs = append(linkRefs, fromSQLBlock(p, keyword, beforeLen))
|
linkRefs = append(linkRefs, fromSQLBlock(p, keyword, beforeLen))
|
||||||
processedParagraphs.Add(p.ID)
|
processedParagraphs.Add(p.ID)
|
||||||
|
|
@ -589,6 +593,10 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
|
||||||
originalRefBlockIDs = map[string]string{}
|
originalRefBlockIDs = map[string]string{}
|
||||||
processedParagraphs := hashset.New()
|
processedParagraphs := hashset.New()
|
||||||
for _, parent := range paragraphParents {
|
for _, parent := range paragraphParents {
|
||||||
|
if nil == parent {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
||||||
refBlock := parentRefParagraphs[parent.ID]
|
refBlock := parentRefParagraphs[parent.ID]
|
||||||
if nil == refBlock {
|
if nil == refBlock {
|
||||||
|
|
|
||||||
|
|
@ -624,6 +624,10 @@ func buildBacklinkListItemRefs(refDefs []*RefDefs) (originalRefBlockIDs map[stri
|
||||||
luteEngine := util.NewLute()
|
luteEngine := util.NewLute()
|
||||||
processedParagraphs := hashset.New()
|
processedParagraphs := hashset.New()
|
||||||
for _, parent := range paragraphParents {
|
for _, parent := range paragraphParents {
|
||||||
|
if nil == parent {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
|
||||||
refBlock := parentRefParagraphs[parent.ID]
|
refBlock := parentRefParagraphs[parent.ID]
|
||||||
if nil == refBlock {
|
if nil == refBlock {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue