From 15ef2a012c8dca7e43bdc4a5e61d122792da5779 Mon Sep 17 00:00:00 2001 From: Marius Niveri Date: Fri, 31 Oct 2025 10:53:06 +0100 Subject: [PATCH] fix: never attempt to concatenate nil values, use empty strings (#2692) (#2812) * fix: never attempt to concatenate nil values, use empty strings (#2692) * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- lua/avante/llm_tools/str_replace.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/avante/llm_tools/str_replace.lua b/lua/avante/llm_tools/str_replace.lua index 358b9e8..572a04a 100644 --- a/lua/avante/llm_tools/str_replace.lua +++ b/lua/avante/llm_tools/str_replace.lua @@ -59,6 +59,10 @@ function M.func(input, opts) local replace_in_file = require("avante.llm_tools.replace_in_file") local Utils = require("avante.utils") + if input.new_str == nil then input.new_str = "" end + + if input.old_str == nil then input.old_str = "" end + -- Remove trailing spaces from the new string input.new_str = Utils.remove_trailing_spaces(input.new_str)