From 44e635fc27360c855400e7491769957db9b2efe5 Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Tue, 4 Apr 2023 15:09:22 +0800 Subject: [PATCH] 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. --- expectations_go18.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expectations_go18.go b/expectations_go18.go index 767ebd4..ccdc2e1 100644 --- a/expectations_go18.go +++ b/expectations_go18.go @@ -16,7 +16,7 @@ func (e *ExpectedQuery) WillReturnRows(rows ...*Rows) *ExpectedQuery { sets := make([]*Rows, len(rows)) for i, r := range rows { sets[i] = r - if r.def != nil { + if r != nil && r.def != nil { defs++ } }