From e7a07364ad8e6f0c3ebae9204e1aacbc230ff05d Mon Sep 17 00:00:00 2001 From: Yochem van Rosmalen Date: Sun, 5 Apr 2026 19:11:59 +0200 Subject: [PATCH] fix(vim.net): check if vim.system's stdout is nil #38713 Problem: Apparently vim.SystemCompleted.stdout can also be nil, even without a custom stdout handler. (Although the docs can be interpreted otherwise). Solution: Explicitly check for nil and set the result body to an empty string if stdout was nil. (cherry picked from commit 398ee83f4f4584322fdc67458a89b5b4c57be49c) --- runtime/lua/vim/net.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/runtime/lua/vim/net.lua b/runtime/lua/vim/net.lua index acf6a44ccc..5919547be7 100644 --- a/runtime/lua/vim/net.lua +++ b/runtime/lua/vim/net.lua @@ -87,9 +87,7 @@ function M.request(url, opts, on_response) err = res.stderr ~= '' and res.stderr or ('Request failed with exit code %d'):format(res.code) else if on_response then - response = { - body = res.stdout --[[@as string]], - } + response = { body = res.stdout or '' } end end