From ff549c5fd3978a4e90349df0aef88cb2c54d7c99 Mon Sep 17 00:00:00 2001 From: Alejandro Torres Date: Thu, 23 Jan 2025 16:48:28 -0500 Subject: [PATCH] handle type assertion correctly --- v2/connection.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v2/connection.go b/v2/connection.go index e9b43d4..fe26389 100755 --- a/v2/connection.go +++ b/v2/connection.go @@ -1135,10 +1135,13 @@ func (conn *Connection) QueryRowContext(ctx context.Context, query string, args stmt := NewStmt(query, conn) stmt.autoClose = true rows, err := stmt.QueryContext(ctx, args) - dataSet := rows.(*DataSet) if err != nil { return &DataSet{lasterr: err} } + dataSet, ok := rows.(*DataSet) + if !ok { + return &DataSet{lasterr: errors.New("type object should be *DataSet")} + } dataSet.Next_() return dataSet }