1
0
Fork 0

Protect against nil return objects

master
Philip O'Toole 8 months ago
parent c36de556ec
commit 0055b69516

@ -652,7 +652,9 @@ func (db *DB) executeStmtWithConn(ctx context.Context, stmt *command.Statement,
defer func() { defer func() {
if retErr != nil { if retErr != nil {
retErr = rewriteContextTimeout(retErr, ErrExecuteTimeout) retErr = rewriteContextTimeout(retErr, ErrExecuteTimeout)
res.Error = retErr.Error() if res != nil {
res.Error = retErr.Error()
}
} }
}() }()
result := &command.ExecuteResult{} result := &command.ExecuteResult{}
@ -813,7 +815,9 @@ func (db *DB) queryStmtWithConn(ctx context.Context, stmt *command.Statement, xT
defer func() { defer func() {
if retErr != nil { if retErr != nil {
retErr = rewriteContextTimeout(retErr, ErrQueryTimeout) retErr = rewriteContextTimeout(retErr, ErrQueryTimeout)
retRows.Error = retErr.Error() if retRows != nil {
retRows.Error = retErr.Error()
}
} }
}() }()
rows := &command.QueryRows{} rows := &command.QueryRows{}

Loading…
Cancel
Save