Skip to content

Commit

Permalink
Don't close a nil cursor (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
goedderz authored Feb 27, 2024
1 parent 235bb8a commit 42fd604
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/operations/normal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ func readRandomlyInParallel(np *NormalProg) error {
}
var cursor driver.Cursor
cursor, err = db.Query(ctx, query, bindVars)
if err != nil {
if cursor != nil {
cursor.Close()
}
} else {
Expand Down Expand Up @@ -1456,7 +1456,7 @@ func writeSomeBatchesParallel(np *NormalProg, number int64) error {
}
var cursor driver.Cursor
cursor, err = db.Query(ctx, query, bindVars)
if err != nil {
if cursor != nil {
cursor.Close()
}
} else {
Expand All @@ -1482,7 +1482,7 @@ func writeSomeBatchesParallel(np *NormalProg, number int64) error {
}
var cursor driver.Cursor
cursor, err = db.Query(ctx, query, bindVars)
if err != nil {
if cursor != nil {
cursor.Close()
}
} else {
Expand Down

0 comments on commit 42fd604

Please sign in to comment.