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