From 444cb0d424089e4ec060ee51f4aacc2926d9fba1 Mon Sep 17 00:00:00 2001 From: TheLeoP Date: Wed, 7 Aug 2024 23:30:38 -0500 Subject: [PATCH] fix(highlight): check if src_line exists before trying to highlight it --- lua/quicker/display.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/quicker/display.lua b/lua/quicker/display.lua index c9faa1c..4f3b9a3 100644 --- a/lua/quicker/display.lua +++ b/lua/quicker/display.lua @@ -180,6 +180,9 @@ local function add_item_highlights_from_buf(qfbufnr, item, line, lnum) local ns = vim.api.nvim_create_namespace("quicker_highlights") -- TODO re-apply highlights when a buffer is loaded or a LSP receives semantic tokens local src_line = vim.api.nvim_buf_get_lines(item.bufnr, item.lnum - 1, item.lnum, false)[1] + if not src_line then + return + end -- If the lines differ only in leading whitespace, we should add highlights anyway and adjust -- the offset.