Skip to content

Commit f6b9e55

Browse files
committed
feat(sda-validator-orchestrator): fix potential nil pointer with readValidationResult rows.Close defer
1 parent 17a07a3 commit f6b9e55

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sda-validator/orchestrator/database/postgres/db_functions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ AND finished_at IS NULL`,
5252

5353
func (db *pgDb) readValidationResult(ctx context.Context, stmt *sql.Stmt, validationID string, userID *string) (*model.ValidationResult, error) {
5454
rows, err := stmt.QueryContext(ctx, validationID, userID)
55-
defer func() {
56-
_ = rows.Close()
57-
}()
5855
if err != nil {
5956
return nil, err
6057
}
58+
defer func() {
59+
_ = rows.Close()
60+
}()
6161

6262
validatorResults := make(map[string]*model.ValidatorResult)
6363

0 commit comments

Comments
 (0)