From a3ac0b84bef6db53ff87a2cab4df4eb0f67491b3 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 7 Jan 2025 14:36:31 +0800 Subject: [PATCH] fix: seleted file is nil (#1049) --- lua/avante/sidebar.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index 007e5b6..525f848 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -1326,13 +1326,15 @@ function Sidebar:render_history_content(history) goto continue end local selected_filepaths = entry.selected_filepaths - if not selected_filepaths then selected_filepaths = { entry.selected_file.filepath } end + if not selected_filepaths and entry.selected_file ~= nil then + selected_filepaths = { entry.selected_file.filepath } + end local prefix = render_chat_record_prefix( entry.timestamp, entry.provider, entry.model, entry.request or "", - selected_filepaths, + selected_filepaths or {}, entry.selected_code ) content = content .. prefix