@@ -5,6 +5,7 @@ local cc_config = require("codecompanion.config").config
55local cc_schema = require (" codecompanion.schema" )
66local http_client = require (" codecompanion.http" )
77local vc_config = require (" vectorcode.config" )
8+ local utils = require (" vectorcode.utils" )
89local check_cli_wrap = vc_config .check_cli_wrap
910local logger = vc_config .logger
1011
@@ -463,9 +464,14 @@ return check_cli_wrap(function(opts)
463464 )
464465
465466 job_runner .run_async (args , function (result , error , code )
466- local err_string = cc_common .flatten_table_to_string (error )
467+ local err_string = utils .flatten_table_to_string (error )
467468
468- if vim .islist (result ) and # result > 0 and result [1 ].path ~= nil then --- @cast result VectorCode.QueryResult[]
469+ if
470+ result ~= nil
471+ and vim .islist (result )
472+ and # result > 0
473+ and result [1 ].path ~= nil
474+ then --- @cast result VectorCode.QueryResult[]
469475 local summary_opts = vim .deepcopy (opts .summarise ) or {}
470476 if type (summary_opts .enabled ) == " function" then
471477 summary_opts .enabled = summary_opts .enabled (tools .chat , result ) --[[ @as boolean]]
@@ -598,7 +604,7 @@ DO NOT MODIFY UNLESS INSTRUCTED BY THE USER, OR A PREVIOUS QUERY RETURNED NO RES
598604 vim .inspect (stderr )
599605 )
600606 )
601- stderr = cc_common .flatten_table_to_string (stderr )
607+ stderr = utils .flatten_table_to_string (stderr )
602608 if string.find (stderr , " InvalidCollectionException" ) then
603609 if cmd .project_root then
604610 tools .chat :add_tool_output (
0 commit comments