mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Fix a NPE in OCR
This commit is contained in:
parent
4724624ef9
commit
5cd46fd7a6
1 changed files with 7 additions and 2 deletions
|
|
@ -242,8 +242,13 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {
|
|||
fields := strings.Split(line, "\t")
|
||||
// 将字段名和字段值映射到一个 map 中
|
||||
dataMap := make(map[string]interface{})
|
||||
for i, header := range strings.Split(lines[0], "\t") {
|
||||
dataMap[header] = fields[i]
|
||||
headers := strings.Split(lines[0], "\t")
|
||||
for i, header := range headers {
|
||||
if i < len(fields) {
|
||||
dataMap[header] = fields[i]
|
||||
} else {
|
||||
dataMap[header] = ""
|
||||
}
|
||||
}
|
||||
ret = append(ret, dataMap)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue