Fix possible nil argument to string.byte (#550)

This commit is contained in:
Jonas Strittmatter
2021-11-18 10:57:24 +01:00
committed by GitHub
parent f2e7685c21
commit c2a9e0ccaa

View File

@@ -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