Skip to content

Commit

Permalink
fix: fixed the null pointer when an audit error occurred in the audit…
Browse files Browse the repository at this point in the history
… plan
  • Loading branch information
iwanghc committed Dec 18, 2024
1 parent f0bcb90 commit daaf33b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sqle/server/auditplan/job_task_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func BatchAuditSQLs(l *logrus.Entry, sqlList []*model.SQLManageRecord) ([]*model

var resp *AuditResultResp
meta, err := GetMeta(sourceType)
// 当无法获取meta时,不执行审核,直接返回原始sql
if err != nil {
l.Errorf("get meta to audit sql fail %v", err)
} else {
Expand All @@ -106,7 +105,12 @@ func BatchAuditSQLs(l *logrus.Entry, sqlList []*model.SQLManageRecord) ([]*model
}
}
mu.Lock()
auditedSQLs = append(auditedSQLs, resp.AuditedSqls...)
// 当审核结果不为nil时,从审核结果中获取sql,其他错误情况直接返回原始sql
if resp != nil {
auditedSQLs = append(auditedSQLs, resp.AuditedSqls...)
} else {
auditedSQLs = append(auditedSQLs, sqls...)
}
mu.Unlock()
}(sqls)
}
Expand Down

0 comments on commit daaf33b

Please sign in to comment.