1
0
mirror of https://github.com/DATA-DOG/go-sqlmock.git synced 2025-03-17 20:48:01 +02:00

Update expectations_go18.go to accept WillReturnRows(nil)

The addition of the resultset logic caused a nil pointer dereference panic whenever nil is used as an input.
This commit is contained in:
Chris Chua 2023-04-04 15:09:22 +08:00 committed by GitHub
parent 44e746a20e
commit 44e635fc27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ func (e *ExpectedQuery) WillReturnRows(rows ...*Rows) *ExpectedQuery {
sets := make([]*Rows, len(rows)) sets := make([]*Rows, len(rows))
for i, r := range rows { for i, r := range rows {
sets[i] = r sets[i] = r
if r.def != nil { if r != nil && r.def != nil {
defs++ defs++
} }
} }