diff options
| author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-09-23 09:23:57 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-23 08:23:57 -0700 |
| commit | 057606e845f36df045466af2821244026b6cf0f3 (patch) | |
| tree | 4079d0af208ea067827f5edb3d40cfff7d7a26e2 | |
| parent | abf13258cfeda1b06d19669756b7c956bd6aab8c (diff) | |
| download | rneovim-057606e845f36df045466af2821244026b6cf0f3.tar.gz rneovim-057606e845f36df045466af2821244026b6cf0f3.tar.bz2 rneovim-057606e845f36df045466af2821244026b6cf0f3.zip | |
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.
| -rw-r--r-- | runtime/lua/vim/diagnostic.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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 = {} |