mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-10 07:58:12 -05:00
Copy fix from #757. The Invoke function had two bugs: A panic would occur when scanning a row containing a NULL value in a TEXT or VARCHAR column. The code did not check for nil before attempting a type assertion on the scanned value. The *sql.Rows result was not being closed on all code paths, leading to connection leaks that could exhaust the database connection pool. This change corrects both issues. A guard clause now checks for nil values before processing, and rows.Close() is deferred to guarantee the connection is released.