Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed the null pointer when an audit error occurred in the audit… #2831

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading