From 678667462f0f50531e746782fc18e648efc25e43 Mon Sep 17 00:00:00 2001 From: Konrad Korzeniowski Date: Tue, 25 Nov 2025 21:37:16 +0100 Subject: [PATCH] Wrapped googleai decoding logic in a pcall --- lua/gp/dispatcher.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/gp/dispatcher.lua b/lua/gp/dispatcher.lua index c28caba..df29362 100644 --- a/lua/gp/dispatcher.lua +++ b/lua/gp/dispatcher.lua @@ -319,9 +319,12 @@ local query = function(buf, provider, payload, handler, on_exit, callback) end if qt.provider == "googleai" then - if line:match('"text":') then - content = vim.json.decode("{" .. line .. "}").text - end + if line:match('"text":') then + local status, result = pcall(vim.json.decode, "{" .. line .. "}") + if status and result and result.text then + content = result.text + end + end end if qt.provider == "ollama" then