You've already forked go-sqlmock
							
							
				mirror of
				https://github.com/DATA-DOG/go-sqlmock.git
				synced 2025-10-30 23:47:46 +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:
		| @@ -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++ | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user