mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 Fix NPE
This commit is contained in:
parent
715ecc57bd
commit
3a53fd4a9a
3 changed files with 15 additions and 0 deletions
|
|
@ -72,6 +72,9 @@ func QueryHistory(stmt string) (ret []map[string]interface{}, err error) {
|
|||
}
|
||||
|
||||
func SelectHistoriesRawStmt(stmt string) (ret []*History) {
|
||||
if nil == historyDB {
|
||||
return
|
||||
}
|
||||
rows, err := historyDB.Query(stmt)
|
||||
if err != nil {
|
||||
logging.LogWarnf("sql query [%s] failed: %s", stmt, err)
|
||||
|
|
@ -101,6 +104,9 @@ func queryHistory(query string, args ...interface{}) (*sql.Rows, error) {
|
|||
if "" == query {
|
||||
return nil, errors.New("statement is empty")
|
||||
}
|
||||
if nil == historyDB {
|
||||
return nil, errors.New("database is nil")
|
||||
}
|
||||
return historyDB.Query(query, args...)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue