From c2a9e0ccaa5c441821f320675c559d723df70f3d Mon Sep 17 00:00:00 2001 From: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> Date: Thu, 18 Nov 2021 10:57:24 +0100 Subject: [PATCH] Fix possible nil argument to string.byte (#550) --- lua/cmp/source.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/cmp/source.lua b/lua/cmp/source.lua index 1d711e3..21566c1 100644 --- a/lua/cmp/source.lua +++ b/lua/cmp/source.lua @@ -237,7 +237,7 @@ source.complete = function(self, ctx, callback) local before_char = string.sub(ctx.cursor_before_line, -1) if ctx:get_reason() == types.cmp.ContextReason.TriggerOnly then before_char = string.match(ctx.cursor_before_line, '(.)%s*$') - if not char.is_symbol(string.byte(before_char)) then + if not before_char or not char.is_symbol(string.byte(before_char)) then before_char = '' end end