From 057606e845f36df045466af2821244026b6cf0f3 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 23 Sep 2021 09:23:57 -0600 Subject: fix(diagnostic): don't return nil when callers expect a table (#15765) diagnostic_lines() returns a table, so make the early exit condition an empty table rather than 'nil'. This way, functions that use the input from diagnostic_lines don't have to do a bunch of defensive nil checking and can always assume they're operating on a table. --- runtime/lua/vim/diagnostic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 961e071273..0539da676e 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -249,7 +249,7 @@ end ---@private local function diagnostic_lines(diagnostics) if not diagnostics then - return + return {} end local diagnostics_by_line = {} -- cgit