Skip to content

Commit

Permalink
Merge pull request #2831 from actiontech/fix_audit_plan_detail_error
Browse files Browse the repository at this point in the history
fix: fixed the null pointer when an audit error occurred in the audit…
  • Loading branch information
LordofAvernus authored Dec 18, 2024
2 parents f0bcb90 + daaf33b commit ee19b94
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 ee19b94

Please sign in to comment.