🐛 v202301271540 logging.go panic 异常,导致内核崩溃 Fix https://github.com/siyuan-note/siyuan/issues/7179

This commit is contained in:
Liang Ding 2023-01-27 19:36:46 +08:00
parent 6235d722d1
commit 6e02ffd7f5
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -91,6 +91,9 @@ func LoadTree(boxID, p string, luteEngine *lute.Lute) (ret *parse.Tree, err erro
}
ial := ReadDocIAL(parentData)
if 1 > len(ial) {
logging.LogWarnf("tree [%s] is corrupted", filePath)
}
title := ial["title"]
if "" == title {
title = "Untitled"
@ -266,6 +269,10 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
func ReadDocIAL(data []byte) (ret map[string]string) {
ret = map[string]string{}
jsoniter.Get(data, "Properties").ToVal(&ret)
val := jsoniter.Get(data, "Properties")
if nil == val {
return
}
val.ToVal(&ret)
return
}